diff options
458 files changed, 19663 insertions, 8668 deletions
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx index 79f5dccc918a..ffc1e95ca796 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx @@ -38,6 +38,7 @@ #include "chartview/ExplicitValueProvider.hxx" #include "chartview/DrawModelWrapper.hxx" #include "AxisHelper.hxx" +#include "DiagramHelper.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; @@ -118,7 +119,7 @@ Reference< chart2::XDiagram > Chart2ModelContact::getChart2Diagram() const return ChartModelHelper::findDiagram( this->getChartModel() ); } -ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const +uno::Reference< lang::XUnoTunnel > Chart2ModelContact::getChartView() const { if(!m_xChartView.is()) { @@ -128,7 +129,12 @@ ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const if( xFact.is() ) m_xChartView = Reference< lang::XUnoTunnel >( xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY ); } + return m_xChartView; +} +ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const +{ + getChartView(); if(!m_xChartView.is()) return 0; @@ -192,30 +198,54 @@ awt::Size Chart2ModelContact::GetPageSize() const return ChartModelHelper::getPageSize(m_xChartModel); } -awt::Rectangle Chart2ModelContact::GetDiagramRectangleInclusive() const +awt::Rectangle Chart2ModelContact::SubstractAxisTitleSizes( const awt::Rectangle& rPositionRect ) { - awt::Rectangle aRect; + awt::Rectangle aRect = ExplicitValueProvider::substractAxisTitleSizes( + m_xChartModel, getChartView(), rPositionRect ); + return aRect; +} + +awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingTitle() const +{ + awt::Rectangle aRect( GetDiagramRectangleIncludingAxes() ); - ExplicitValueProvider* pProvider( getExplicitValueProvider() ); - if( pProvider ) - { - aRect = pProvider->getRectangleOfObject( lcl_getCIDForDiagram( m_xChartModel ) ); - } //add axis title sizes to the diagram size - aRect = ExplicitValueProvider::calculateDiagramPositionAndSizeInclusiveTitle( - m_xChartModel, m_xChartView, aRect ); + aRect = ExplicitValueProvider::addAxisTitleSizes( + m_xChartModel, getChartView(), aRect ); return aRect; } -awt::Size Chart2ModelContact::GetDiagramSizeInclusive() const +awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingAxes() const { - return ToSize( this->GetDiagramRectangleInclusive() ); + awt::Rectangle aRect(0,0,0,0); + uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) ); + + if( DiagramPositioningMode_INCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram ) ) + aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel); + else + { + ExplicitValueProvider* pProvider( getExplicitValueProvider() ); + if( pProvider ) + aRect = pProvider->getRectangleOfObject( C2U("PlotAreaIncludingAxes") ); + } + return aRect; } -awt::Point Chart2ModelContact::GetDiagramPositionInclusive() const +awt::Rectangle Chart2ModelContact::GetDiagramRectangleExcludingAxes() const { - return ToPoint( this->GetDiagramRectangleInclusive() ); + awt::Rectangle aRect(0,0,0,0); + uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) ); + + if( DiagramPositioningMode_EXCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram ) ) + aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel); + else + { + ExplicitValueProvider* pProvider( getExplicitValueProvider() ); + if( pProvider ) + aRect = pProvider->getDiagramRectangleExcludingAxes(); + } + return aRect; } awt::Size Chart2ModelContact::GetLegendSize() const diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx index dea25ddd50e4..e20167e216c2 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx @@ -93,15 +93,24 @@ public: */ ::com::sun::star::awt::Size GetPageSize() const; - /** Returns the size of the diagram object in logic coordinates inclusive - the space reserved for axis titles. + /** calculates the current axes title sizes and substract that space them from the given recangle */ - ::com::sun::star::awt::Size GetDiagramSizeInclusive() const; + ::com::sun::star::awt::Rectangle SubstractAxisTitleSizes( const ::com::sun::star::awt::Rectangle& rPositionRect ); - /** Returns the position of the diagram in logic coordinates inclusive - the space reserved for axis titles. + /** Returns the position and size of the diagram in logic coordinates (100th mm) including + the space used for axes including axes titles. */ - ::com::sun::star::awt::Point GetDiagramPositionInclusive() const; + ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingTitle() const; + + /** Returns the position and size of the diagram in logic coordinates (100th mm) including + the space used for axes excluding axes titles. + */ + ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingAxes() const; + + /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding + the space used for axes (inner plot area). + */ + ::com::sun::star::awt::Rectangle GetDiagramRectangleExcludingAxes() const; /** Returns the size of the object in logic coordinates. */ @@ -134,7 +143,8 @@ public: private: //methods ExplicitValueProvider* getExplicitValueProvider() const; - ::com::sun::star::awt::Rectangle GetDiagramRectangleInclusive() const; + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XUnoTunnel > getChartView() const; public: //member ::com::sun::star::uno::Reference< diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index b1db5981f6b3..e05279b15aae 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -59,6 +59,7 @@ #include "DisposeHelper.hxx" #include <comphelper/InlineContainer.hxx> #include "WrappedAutomaticPositionProperties.hxx" +#include "CommonConverters.hxx" #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart2/XTitled.hpp> @@ -737,49 +738,23 @@ Reference< awt::Point SAL_CALL DiagramWrapper::getPosition() throw (uno::RuntimeException) { - awt::Point aPosition; - - Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); - if( xProp.is() ) - { - bool bSet = false; - chart2::RelativePosition aRelativePosition; - uno::Any aAPosition( xProp->getPropertyValue( C2U( "RelativePosition" ) ) ); - if( aAPosition >>= aRelativePosition ) - { - awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() ); - aPosition.X = static_cast<sal_Int32>(aRelativePosition.Primary*aPageSize.Width); - aPosition.Y = static_cast<sal_Int32>(aRelativePosition.Secondary*aPageSize.Height); - - aPosition = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( - aPosition, DiagramWrapper::getSize(), aRelativePosition.Anchor ); - - bSet = true; - } - if(!bSet) - aPosition = m_spChart2ModelContact->GetDiagramPositionInclusive(); - } - + awt::Point aPosition = ToPoint( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() ); return aPosition; } void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); if( xProp.is() ) { - if( aPosition.X < 0 || aPosition.Y < 0 ) + if( aPosition.X < 0 || aPosition.Y < 0 || aPosition.X > 1 || aPosition.Y > 1 ) { - if( !TitleHelper::getTitle( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() && - !TitleHelper::getTitle( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() ) - { - DBG_ERROR("DiagramWrapper::setPosition called with negative position -> automatic values are taken instead" ); - uno::Any aEmpty; - xProp->setPropertyValue( C2U( "RelativePosition" ), aEmpty ); - return; - } - //else: The saved didagram size does include the axis title sizes thus the position and size could be negative + DBG_ERROR("DiagramWrapper::setPosition called with a position out of range -> automatic values are taken instead" ); + uno::Any aEmpty; + xProp->setPropertyValue( C2U( "RelativePosition" ), aEmpty ); + return; } awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() ); @@ -789,31 +764,14 @@ void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition ) aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width); aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height); xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) ); + xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) ); } } awt::Size SAL_CALL DiagramWrapper::getSize() throw (uno::RuntimeException) { - awt::Size aSize; - - Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); - if( xProp.is() ) - { - bool bSet = false; - chart2::RelativeSize aRelativeSize; - uno::Any aASize( xProp->getPropertyValue( C2U( "RelativeSize" ) ) ); - if(aASize>>=aRelativeSize) - { - awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() ); - aSize.Width = static_cast<sal_Int32>(aRelativeSize.Primary*aPageSize.Width); - aSize.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*aPageSize.Height); - bSet = true; - } - if(!bSet) - aSize = m_spChart2ModelContact->GetDiagramSizeInclusive(); - } - + awt::Size aSize = ToSize( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() ); return aSize; } @@ -821,6 +779,7 @@ void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); if( xProp.is() ) { @@ -832,18 +791,14 @@ void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize ) if( aRelativeSize.Primary > 1 || aRelativeSize.Secondary > 1 ) { - if( !TitleHelper::getTitle( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() && - !TitleHelper::getTitle( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() ) - { - DBG_ERROR("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" ); - uno::Any aEmpty; - xProp->setPropertyValue( C2U( "RelativeSize" ), aEmpty ); - return; - } - //else: The saved didagram size does include the axis title sizes thus the position and size could be out of range + DBG_ERROR("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" ); + uno::Any aEmpty; + xProp->setPropertyValue( C2U( "RelativeSize" ), aEmpty ); + return; } xProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) ); + xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) ); } } @@ -854,6 +809,81 @@ OUString SAL_CALL DiagramWrapper::getShapeType() return C2U( "com.sun.star.chart.Diagram" ); } +// ____ XDiagramPositioning ____ + +void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException) +{ + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); + if( xDiaProps.is() ) + { + xDiaProps->setPropertyValue( C2U( "RelativeSize" ), Any() ); + xDiaProps->setPropertyValue( C2U( "RelativePosition" ), Any() ); + } +} +::sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning( ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); + if( xDiaProps.is() ) + { + Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) ); + Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) ); + if( aRelativeSize.hasValue() && aRelativePosition.hasValue() ) + return false; + } + return true; +} +void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) +{ + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); + uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); + if( xDiaProps.is() ) + xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(true) ); +} +::sal_Bool SAL_CALL DiagramWrapper::isExcludingDiagramPositioning() throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); + if( xDiaProps.is() ) + { + Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) ); + Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) ); + if( aRelativeSize.hasValue() && aRelativePosition.hasValue() ) + { + sal_Bool bPosSizeExcludeAxes = false; + xDiaProps->getPropertyValue( C2U( "PosSizeExcludeAxes" ) ) >>= bPosSizeExcludeAxes; + return bPosSizeExcludeAxes; + } + } + return false; +} +awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes( ) throw (uno::RuntimeException) +{ + return m_spChart2ModelContact->GetDiagramRectangleExcludingAxes(); +} +void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) +{ + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); + uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); + if( xDiaProps.is() ) + xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(false) ); +} +awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes( ) throw (uno::RuntimeException) +{ + return m_spChart2ModelContact->GetDiagramRectangleIncludingAxes(); +} +void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) +{ + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) ); + DiagramWrapper::setDiagramPositionIncludingAxes( aRect ); +} +::com::sun::star::awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException) +{ + return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle(); +} + // ____ XAxisZSupplier ____ Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle() diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx index 96689eec2aac..111e24bd6a8b 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx @@ -30,12 +30,13 @@ #include "WrappedPropertySet.hxx" #include "ServiceMacros.hxx" #include "DiagramHelper.hxx" -#include <cppuhelper/implbase11.hxx> +#include <cppuhelper/implbase12.hxx> #include <comphelper/uno3.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XDiagramProvider.hpp> #include <com/sun/star/chart2/XChartTypeTemplate.hpp> #include <com/sun/star/chart2/XChartTypeManager.hpp> @@ -61,7 +62,7 @@ namespace wrapper class Chart2ModelContact; -class DiagramWrapper : public ::cppu::ImplInheritanceHelper11< +class DiagramWrapper : public ::cppu::ImplInheritanceHelper12< WrappedPropertySet , ::com::sun::star::chart::XDiagram , ::com::sun::star::chart::XAxisZSupplier @@ -73,6 +74,7 @@ class DiagramWrapper : public ::cppu::ImplInheritanceHelper11< , ::com::sun::star::lang::XServiceInfo , ::com::sun::star::lang::XComponent // , ::com::sun::star::lang::XEventListener + , ::com::sun::star::chart::XDiagramPositioning , ::com::sun::star::chart2::XDiagramProvider , ::com::sun::star::chart::XSecondAxisTitleSupplier > @@ -209,6 +211,18 @@ public: // virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) // throw (::com::sun::star::uno::RuntimeException); + // ____ XDiagramPositioning ____ + + virtual void SAL_CALL setAutomaticDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isAutomaticDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDiagramPositionExcludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isExcludingDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionExcludingAxes( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDiagramPositionIncludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxes( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDiagramPositionIncludingAxesAndAxisTitles( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException); + // ____ XDiagramProvider ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > SAL_CALL getDiagram() diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc index ba9a330b250e..1f445083738f 100644 --- a/chart2/source/controller/dialogs/TabPages.hrc +++ b/chart2/source/controller/dialogs/TabPages.hrc @@ -46,7 +46,6 @@ ////#define RBT_DOWNUP 3 ////#define RBT_AUTOORDER 4 -//#define TP_STAT 905 #define FL_TEXTBREAK 3 #define CBX_TEXTBREAK 2 #define CBX_TEXTOVERLAP 4 diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index fbcca6a26bde..48c96a715c5f 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -30,6 +30,7 @@ #include "DrawViewWrapper.hxx" #include "chartview/DrawModelWrapper.hxx" #include "ConfigurationAccess.hxx" +#include "macros.hxx" #include <unotools/lingucfg.hxx> #include <editeng/langitem.hxx> @@ -241,6 +242,14 @@ SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const if( pRet ) { + //ignore some special shapes + rtl::OUString aShapeName = pRet->GetName(); + if( aShapeName.match(C2U("PlotAreaIncludingAxes")) || aShapeName.match(C2U("PlotAreaExcludingAxes")) ) + { + pRet->SetMarkProtect( true ); + return getHitObject( rPnt ); + } + //3d objects need a special treatment //because the simple PickObj method is not accurate in this case for performance reasons E3dObject* pE3d = dynamic_cast< E3dObject* >(pRet); diff --git a/chart2/source/controller/inc/PositionAndSizeHelper.hxx b/chart2/source/controller/inc/PositionAndSizeHelper.hxx index 43392e7a8235..312c92997055 100644 --- a/chart2/source/controller/inc/PositionAndSizeHelper.hxx +++ b/chart2/source/controller/inc/PositionAndSizeHelper.hxx @@ -51,8 +51,7 @@ public: static bool moveObject( const rtl::OUString& rObjectCID , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel , const ::com::sun::star::awt::Rectangle& rNewPositionAndSize - , const ::com::sun::star::awt::Rectangle& rPageRectangle - , ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xChartView ); + , const ::com::sun::star::awt::Rectangle& rPageRectangle ); }; //............................................................................. diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx index b3c4b7ea19f7..f7ddeb42c11e 100644 --- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx +++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx @@ -87,27 +87,6 @@ const USHORT nGridWhichPairs[] = 0 }; -const USHORT nChartWhichPairs[] = -{ - SCHATTR_STYLE_START,SCHATTR_STYLE_END, // 59 - 68 sch/schattr.hxx - 0 -}; - -const USHORT nDiagramAreaWhichPairs[] = -{ - XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx - XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx - 0 -}; - -const USHORT nAreaAndChartWhichPairs[] = // pairs for chart AND area -{ - XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx - XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx - SCHATTR_STYLE_START,SCHATTR_STYLE_END, // 59 - 68 sch/schattr.hxx - 0 -}; - const USHORT nLegendWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 8deffe47396f..81f4ba5a549e 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -725,6 +725,8 @@ private: void impl_SetMousePointer( const MouseEvent & rEvent ); void impl_ClearSelection(); + + void impl_switchDiagramPositioningToExcludingPositioning(); }; //............................................................................. diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 6c988ebf22d5..3105ee53bf14 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -172,8 +172,7 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , m_aModel->getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) - , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) - , m_xChartView ); + , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); if( bChanged ) aUndoGuard.commitAction(); } diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index ff567636ba0e..11fa5e74054e 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -50,6 +50,7 @@ #include "RegressionCurveHelper.hxx" #include "ShapeController.hxx" #include "DiagramHelper.hxx" +#include "ObjectNameProvider.hxx" #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/beans/XPropertyState.hpp> @@ -242,6 +243,7 @@ void ChartController::executeDispatch_NewArrangement() Reference< beans::XPropertyState > xState( xDiagram, uno::UNO_QUERY_THROW ); xState->setPropertyToDefault( C2U("RelativeSize")); xState->setPropertyToDefault( C2U("RelativePosition")); + xState->setPropertyToDefault( C2U("PosSizeExcludeAxes")); // 3d rotation ThreeDHelper::set3DSettingsToDefault( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ) ); @@ -468,6 +470,8 @@ void ChartController::impl_PasteShapes( SdrModel* pModel ) m_aSelection.applySelection( m_pDrawViewWrapper ); m_pDrawViewWrapper->EndUndo(); + + impl_switchDiagramPositioningToExcludingPositioning(); } } } @@ -514,6 +518,8 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons m_pDrawViewWrapper->BegUndo( SVX_RESSTR( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) ); m_pDrawViewWrapper->AddUndo( new SdrUndoInsertObj( *pObj ) ); m_pDrawViewWrapper->EndUndo(); + + impl_switchDiagramPositioningToExcludingPositioning(); } } catch ( const uno::Exception& ex ) @@ -902,4 +908,14 @@ void ChartController::impl_ShapeControllerDispatch( const util::URL& rURL, const } } +void ChartController::impl_switchDiagramPositioningToExcludingPositioning() +{ + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::POS_SIZE, + ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)), + m_xUndoManager, m_aModel->getModel() ); + if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_aModel->getModel(), true, true ) ) + aUndoGuard.commitAction(); +} + } // namespace chart diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 6049be7e3199..8b3deca4e2dd 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -797,6 +797,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() ) { pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND ); + impl_switchDiagramPositioningToExcludingPositioning(); if ( pDrawViewWrapper->AreObjectsMarked() ) { if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) @@ -870,8 +871,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , m_aModel->getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) - , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) - , m_xChartView ); + , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); if( bChanged ) { bDraggingDone = true; diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx index 089abb1822f6..f0ce3eaaa04e 100644 --- a/chart2/source/controller/main/PositionAndSizeHelper.cxx +++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx @@ -141,8 +141,6 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType { //@todo decide wether x is primary or secondary - //xChartView - //set position: chart2::RelativePosition aRelativePosition; aRelativePosition.Anchor = drawing::Alignment_CENTER; @@ -169,7 +167,6 @@ bool PositionAndSizeHelper::moveObject( const rtl::OUString& rObjectCID , const uno::Reference< frame::XModel >& xChartModel , const awt::Rectangle& rNewPositionAndSize , const awt::Rectangle& rPageRectangle - , uno::Reference< uno::XInterface > xChartView ) { ControllerLockGuard aLockedControllers( xChartModel ); @@ -183,10 +180,6 @@ bool PositionAndSizeHelper::moveObject( const rtl::OUString& rObjectCID xObjectProp = uno::Reference< beans::XPropertySet >( ObjectIdentifier::getDiagramForCID( rObjectCID, xChartModel ), uno::UNO_QUERY ); if(!xObjectProp.is()) return false; - - //add axis title sizes to the diagram size - aNewPositionAndSize = ExplicitValueProvider::calculateDiagramPositionAndSizeInclusiveTitle( - xChartModel, xChartView, rNewPositionAndSize ); } return moveObject( eObjectType, xObjectProp, aNewPositionAndSize, rPageRectangle ); } diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 14113e7396ca..c7cda6189680 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -46,6 +46,13 @@ namespace chart { +enum DiagramPositioningMode +{ + DiagramPositioningMode_AUTO, + DiagramPositioningMode_EXCLUDING, + DiagramPositioningMode_INCLUDING +}; + class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper { public: @@ -318,6 +325,19 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static DiagramPositioningMode getDiagramPositioningMode( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static bool setDiagramPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, + const ::com::sun::star::awt::Rectangle& rPosRect /*100th mm*/ ); + + static ::com::sun::star::awt::Rectangle getDiagramRectangleFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel ); + + static bool switchDiagramPositioningToExcludingPositioning( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , bool bResetModifiedState //set model back to unchanged if it was unchanged before + , bool bConvertAlsoFromAutoPositioning ); + private: // not implemented DiagramHelper(); diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx index 49d38a4247ac..d10ee8d415fc 100644 --- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx +++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx @@ -68,6 +68,8 @@ public: virtual ::com::sun::star::awt::Rectangle getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false )=0; + virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes()=0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getShapeForCID( const rtl::OUString& rObjectCID )=0; @@ -77,12 +79,20 @@ public: static ExplicitValueProvider* getExplicitValueProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChartView ); static ::com::sun::star::awt::Rectangle - calculateDiagramPositionAndSizeInclusiveTitle( + addAxisTitleSizes( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& xChartView + , const ::com::sun::star::awt::Rectangle& rExcludingPositionAndSize ); + + static ::com::sun::star::awt::Rectangle + substractAxisTitleSizes( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChartView - , const ::com::sun::star::awt::Rectangle& rExclusivePositionAndSize ); + , const ::com::sun::star::awt::Rectangle& rPositionAndSizeIncludingTitles ); static sal_Int32 getExplicitNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index f74764c398ef..b24f4059ba74 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -71,6 +71,7 @@ enum { PROP_DIAGRAM_REL_POS, PROP_DIAGRAM_REL_SIZE, + PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, PROP_DIAGRAM_SORT_BY_X_VALUES, PROP_DIAGRAM_CONNECT_BARS, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, @@ -101,6 +102,13 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEVOID )); rOutProperties.push_back( + Property( C2U( "PosSizeExcludeAxes" ), + PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, + ::getBooleanCppuType(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( Property( C2U( "SortByXValues" ), PROP_DIAGRAM_SORT_BY_X_VALUES, ::getBooleanCppuType(), @@ -171,6 +179,7 @@ void lcl_AddPropertiesToVector( void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true ); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index b95e7522943e..4ce623ae460c 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -39,8 +39,13 @@ #include "CommonConverters.hxx" #include "ExplicitCategoriesProvider.hxx" #include "servicenames_charttypes.hxx" +#include "ChartModelHelper.hxx" +#include "RelativePositionHelper.hxx" +#include "ControllerLockGuard.hxx" #include <com/sun/star/chart/MissingValueTreatment.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XChartTypeTemplate.hpp> @@ -49,10 +54,14 @@ #include <com/sun/star/chart2/InterpretedData.hpp> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> -#include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> +#include <unotools/saveopt.hxx> #include <rtl/math.hxx> +#include <com/sun/star/util/XModifiable.hpp> + using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using namespace ::std; @@ -1407,4 +1416,142 @@ sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( return nResult; } +//static +DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const uno::Reference< + chart2::XDiagram > & xDiagram ) +{ + DiagramPositioningMode eMode = DiagramPositioningMode_AUTO; + uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY ); + if( xDiaProps.is() ) + { + RelativePosition aRelPos; + RelativeSize aRelSize; + if( (xDiaProps->getPropertyValue(C2U("RelativePosition")) >>= aRelPos ) && + (xDiaProps->getPropertyValue(C2U("RelativeSize")) >>= aRelSize ) ) + { + bool bPosSizeExcludeAxes=false; + xDiaProps->getPropertyValue(C2U("PosSizeExcludeAxes")) >>= bPosSizeExcludeAxes; + if( bPosSizeExcludeAxes ) + eMode = DiagramPositioningMode_EXCLUDING; + else + eMode = DiagramPositioningMode_INCLUDING; + } + } + return eMode; +} + +void lcl_ensureRange0to1( double& rValue ) +{ + if(rValue<0.0) + rValue=0.0; + if(rValue>1.0) + rValue=1.0; +} + +//static +bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel, + const awt::Rectangle& rPosRect /*100th mm*/ ) +{ + ControllerLockGuard aCtrlLockGuard( xChartModel ); + + bool bChanged = false; + awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) ); + uno::Reference< beans::XPropertySet > xDiaProps( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY ); + if( !xDiaProps.is() ) + return bChanged; + + RelativePosition aOldPos; + RelativeSize aOldSize; + xDiaProps->getPropertyValue(C2U("RelativePosition") ) >>= aOldPos; + xDiaProps->getPropertyValue(C2U("RelativeSize") ) >>= aOldSize; + + RelativePosition aNewPos; + aNewPos.Anchor = drawing::Alignment_TOP_LEFT; + aNewPos.Primary = double(rPosRect.X)/double(aPageSize.Width); + aNewPos.Secondary = double(rPosRect.Y)/double(aPageSize.Height); + + chart2::RelativeSize aNewSize; + aNewSize.Primary = double(rPosRect.Width)/double(aPageSize.Width); + aNewSize.Secondary = double(rPosRect.Height)/double(aPageSize.Height); + + lcl_ensureRange0to1( aNewPos.Primary ); + lcl_ensureRange0to1( aNewPos.Secondary ); + lcl_ensureRange0to1( aNewSize.Primary ); + lcl_ensureRange0to1( aNewSize.Secondary ); + if( (aNewPos.Primary + aNewSize.Primary) > 1.0 ) + aNewPos.Primary = 1.0 - aNewSize.Primary; + if( (aNewPos.Secondary + aNewSize.Secondary) > 1.0 ) + aNewPos.Secondary = 1.0 - aNewSize.Secondary; + + xDiaProps->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aNewPos) ); + xDiaProps->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aNewSize) ); + + bChanged = (aOldPos.Anchor!=aNewPos.Anchor) || + (aOldPos.Primary!=aNewPos.Primary) || + (aOldPos.Secondary!=aNewPos.Secondary) || + (aOldSize.Primary!=aNewSize.Primary) || + (aOldSize.Secondary!=aNewSize.Secondary); + return bChanged; +} + +//static +awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference< frame::XModel >& xChartModel ) +{ + awt::Rectangle aRet(-1,-1,-1,-1); + + uno::Reference< beans::XPropertySet > xDiaProps( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY ); + if( !xDiaProps.is() ) + return aRet; + + awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) ); + + RelativePosition aRelPos; + RelativeSize aRelSize; + xDiaProps->getPropertyValue(C2U("RelativePosition") ) >>= aRelPos; + xDiaProps->getPropertyValue(C2U("RelativeSize") ) >>= aRelSize; + + awt::Size aAbsSize( + aRelSize.Primary * aPageSize.Width, + aRelSize.Secondary * aPageSize.Height ); + + awt::Point aAbsPos( + static_cast< sal_Int32 >( aRelPos.Primary * aPageSize.Width ), + static_cast< sal_Int32 >( aRelPos.Secondary * aPageSize.Height )); + + awt::Point aAbsPosLeftTop = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( aAbsPos, aAbsSize, aRelPos.Anchor ); + + aRet = awt::Rectangle(aAbsPosLeftTop.X, aAbsPosLeftTop.Y, aAbsSize.Width, aAbsSize.Height ); + + return aRet; +} + +//static +bool DiagramHelper::switchDiagramPositioningToExcludingPositioning( + const uno::Reference< frame::XModel >& xChartModel + , bool bResetModifiedState, bool bConvertAlsoFromAutoPositioning ) +{ + //return true if something was changed + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//#i100778# todo: change this dependent on fileformat evolution + { + uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( xChartModel, uno::UNO_QUERY ) ; + if( xOldDoc.is() ) + { + uno::Reference< ::com::sun::star::chart::XDiagramPositioning > xDiagramPositioning( xOldDoc->getDiagram(), uno::UNO_QUERY ); + if( xDiagramPositioning.is() && ( bConvertAlsoFromAutoPositioning || !xDiagramPositioning->isAutomaticDiagramPositioning() ) + && !xDiagramPositioning->isExcludingDiagramPositioning() ) + { + ControllerLockGuard aCtrlLockGuard( xChartModel ); + uno::Reference< util::XModifiable > xModifiable( xChartModel, uno::UNO_QUERY ); + bool bModelWasModified = xModifiable.is() && xModifiable->isModified(); + xDiagramPositioning->setDiagramPositionExcludingAxes( xDiagramPositioning->calculateDiagramPositionExcludingAxes() ); + if(bResetModifiedState && !bModelWasModified && xModifiable.is() ) + xModifiable->setModified(sal_False); + return true; + } + } + } + return false; +} + } // namespace chart diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index b9eac0fc7291..eee13848b11b 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -121,10 +121,12 @@ bool PiePositionHelper::getInnerAndOuterRadius( double fCategoryX //----------------------------------------------------------------------------- PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel - , sal_Int32 nDimensionCount ) + , sal_Int32 nDimensionCount + , bool bExcludingPositioning ) : VSeriesPlotter( xChartTypeModel, nDimensionCount ) , m_pPosHelper( new PiePositionHelper( NormalAxis_Z, (m_nDimension==3)?0.0:90.0 ) ) , m_bUseRings(false) + , m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning) { ::rtl::math::setNan(&m_fMaxOffset); @@ -181,6 +183,11 @@ bool PieChart::keepAspectRatio() const return true; } +bool PieChart::shouldSnapRectToUsedArea() +{ + return true; +} + //----------------------------------------------------------------- // lang::XServiceInfo //----------------------------------------------------------------- @@ -273,18 +280,21 @@ double PieChart::getMaxOffset() if(fExplodePercentage>m_fMaxOffset) m_fMaxOffset=fExplodePercentage; - uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeriesProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) + if(!m_bSizeExcludesLabelsAndExplodedSegments) { - for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) + uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; + if( xSeriesProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) { - uno::Reference< beans::XPropertySet > xPointProp( pSeries->getPropertiesOfPoint(aAttributedDataPointIndexList[nN]) ); - if(xPointProp.is()) + for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { - fExplodePercentage=0.0; - xPointProp->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage; - if(fExplodePercentage>m_fMaxOffset) - m_fMaxOffset=fExplodePercentage; + uno::Reference< beans::XPropertySet > xPointProp( pSeries->getPropertiesOfPoint(aAttributedDataPointIndexList[nN]) ); + if(xPointProp.is()) + { + fExplodePercentage=0.0; + xPointProp->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage; + if(fExplodePercentage>m_fMaxOffset) + m_fMaxOffset=fExplodePercentage; + } } } } @@ -396,7 +406,8 @@ void PieChart::createShapes() for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ ) { double fLogicInnerRadius, fLogicOuterRadius; - bool bIsVisible = m_pPosHelper->getInnerAndOuterRadius( fSlotX+1.0, fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, getMaxOffset() ); + double fOffset = getMaxOffset(); + bool bIsVisible = m_pPosHelper->getInnerAndOuterRadius( fSlotX+1.0, fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, fOffset ); if( !bIsVisible ) continue; diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx index 52545f6476b8..e6fedb05d52e 100644 --- a/chart2/source/view/charttypes/PieChart.hxx +++ b/chart2/source/view/charttypes/PieChart.hxx @@ -46,7 +46,7 @@ class PieChart : public VSeriesPlotter public: PieChart( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartTypeModel - , sal_Int32 nDimensionCount ); + , sal_Int32 nDimensionCount, bool bExcludingPositioning ); virtual ~PieChart(); //------------------------------------------------------------------------- @@ -72,6 +72,7 @@ public: //------------------- virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const; virtual bool keepAspectRatio() const; + virtual bool shouldSnapRectToUsedArea(); //MinimumAndMaximumSupplier virtual double getMinimumX(); @@ -113,6 +114,7 @@ struct PieLabelInfo; private: //member PiePositionHelper* m_pPosHelper; bool m_bUseRings; + bool m_bSizeExcludesLabelsAndExplodedSegments; struct PieLabelInfo { diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 37888c8f0a9b..840cbbe3e1e1 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1744,6 +1744,13 @@ bool VSeriesPlotter::WantToPlotInFrontOfAxisLine() return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel ); } +bool VSeriesPlotter::shouldSnapRectToUsedArea() +{ + if( m_nDimension == 3 ) + return false; + return true; +} + Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( LegendExpansion eLegendExpansion , const Reference< beans::XPropertySet >& xTextProperties @@ -2066,7 +2073,8 @@ std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForCh //static VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( const uno::Reference<XChartType>& xChartTypeModel - , sal_Int32 nDimensionCount ) + , sal_Int32 nDimensionCount + , bool bExcludingPositioning ) { rtl::OUString aChartType = xChartTypeModel->getChartType(); @@ -2085,7 +2093,7 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) pRet = new BubbleChart(xChartTypeModel,nDimensionCount); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - pRet = new PieChart(xChartTypeModel,nDimensionCount); + pRet = new PieChart(xChartTypeModel,nDimensionCount, bExcludingPositioning ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,false,1,drawing::Direction3D(1,1,1) ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index 5ffec22969a0..4174226b6f62 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -49,6 +49,8 @@ #include <com/sun/star/lang/XTypeProvider.hpp> // header for class SvxShape #include <svx/unoshape.hxx> +// header for GetSdrObjectFromXShape +#include <svx/unoapi.hxx> // header for class E3dScene #include <svx/scene3d.hxx> #include <rtl/math.hxx> @@ -179,6 +181,8 @@ void VDiagram::createShapes_2d() uno::Reference< drawing::XShapes > xOuterGroup_Shapes = m_pShapeFactory->createGroup2D(m_xLogicTarget); m_xOuterGroupShape = uno::Reference<drawing::XShape>( xOuterGroup_Shapes, uno::UNO_QUERY ); + uno::Reference< drawing::XShapes > xGroupForWall( m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,C2U("PlotAreaExcludingAxes")) ); + //create independent group shape as container for datapoints and such things { uno::Reference< drawing::XShapes > xShapes = m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,C2U("testonly;CooContainer=XXX_CID")); @@ -195,8 +199,7 @@ void VDiagram::createShapes_2d() "com.sun.star.drawing.RectangleShape" ) ), uno::UNO_QUERY ); //m_xWall2D->setPosition(m_aAvailablePosIncludingAxes); //m_xWall2D->setSize(m_aAvailableSizeIncludingAxes); - uno::Reference< drawing::XShapes > xShapes( m_xCoordinateRegionShape, uno::UNO_QUERY ); - xShapes->add(m_xWall2D); + xGroupForWall->add(m_xWall2D); uno::Reference< beans::XPropertySet > xProp( m_xWall2D, uno::UNO_QUERY ); if( xProp.is()) { @@ -518,6 +521,7 @@ void VDiagram::createShapes_3d() m_xOuterGroupShape = uno::Reference< drawing::XShape >( m_xShapeFactory->createInstance( C2U( "com.sun.star.drawing.Shape3DSceneObject" ) ), uno::UNO_QUERY ); + ShapeFactory::setShapeName( m_xOuterGroupShape, C2U("PlotAreaExcludingAxes") ); m_xLogicTarget->add(m_xOuterGroupShape); uno::Reference< drawing::XShapes > xOuterGroup_Shapes = diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 02c1f3b044e9..6b6b06437542 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -264,7 +264,8 @@ public: static VSeriesPlotter* createSeriesPlotter( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartTypeModel - , sal_Int32 nDimensionCount ); + , sal_Int32 nDimensionCount + , bool bExcludingPositioning = false /*for pie and donut charts labels and exploded segments are excluded from the given size*/); sal_Int32 getPointCount() const; @@ -293,6 +294,7 @@ public: virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize ); bool WantToPlotInFrontOfAxisLine(); + virtual bool shouldSnapRectToUsedArea(); //------------------------------------------------------------------------- //------------------------------------------------------------------------- diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 83368fa3907a..d8f997d36da9 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -37,6 +37,7 @@ #include <editeng/brshitem.hxx> #include <editeng/sizeitem.hxx> #include <svl/stritem.hxx> +#include <svl/rectitem.hxx> #include <svl/ilstitem.hxx> #define _SVSTDARR_ULONGS #include <svl/svstdarr.hxx> diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index c5ba0c38ab05..c13216a041d7 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -169,6 +169,7 @@ ChartView::ChartView( , m_nScaleYNumerator(1) , m_nScaleYDenominator(1) , m_bSdrViewIsInEditMode(sal_False) + , m_aResultingDiagramRectangleExcludingAxes(0,0,0,0) { } @@ -313,7 +314,7 @@ uno::Any SAL_CALL ChartView::getTransferData( const datatransfer::DataFlavor& aF if( ! (bHighContrastMetaFile || aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMEType)) ) return aRet; - impl_updateView(); + update(); SvMemoryStream aStream( 1024, 1024 ); utl::OStreamWrapper* pStreamWrapper = new utl::OStreamWrapper( aStream ); @@ -681,7 +682,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( if(nT==0) m_bChartTypeUsesShiftedXAxisTicksPerDefault = ChartTypeHelper::shiftTicksAtXAxisPerDefault( xChartType ); - VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter( xChartType, nDimensionCount ); + bool bExcludingPositioning = DiagramPositioningMode_EXCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram ); + VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter( xChartType, nDimensionCount, bExcludingPositioning ); if( !pPlotter ) continue; m_aSeriesPlotterList.push_back( pPlotter ); @@ -1166,7 +1168,7 @@ drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio() namespace { -bool lcl_resizeAfterCompleteCreation( const uno::Reference< XDiagram >& xDiagram ) +bool lcl_IsPieOrDonut( const uno::Reference< XDiagram >& xDiagram ) { //special treatment for pie charts //the size is checked after complete creation to get the datalabels into the given space @@ -1324,16 +1326,23 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( ::boost::shared_ptr< DrawModelWrapp } //end anonymous namespace //------------ create complete diagram shape (inclusive axis and series) -void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer + +awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer , const uno::Reference< drawing::XShapes>& xDiagramPlusAxes_Shapes , const awt::Point& rAvailablePos , const awt::Size& rAvailableSize - , const awt::Size& rPageSize ) + , const awt::Size& rPageSize + , bool bUseFixedInnerSize + , const uno::Reference< drawing::XShape>& xDiagram_MarkHandles /*needs to be resized to fit the result*/ + ) { + //return the used rectangle + awt::Rectangle aUsedOuterRect( rAvailablePos.X, rAvailablePos.Y, 0, 0 ); + // sal_Int32 nDiagramIndex = 0;//todo if more than one diagam is supported uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) ); if( !xDiagram.is()) - return; + return aUsedOuterRect; sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); if(!nDimensionCount) @@ -1389,7 +1398,8 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory); aVDiagram.createShapes(rAvailablePos,rAvailableSize); xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion(); - aVDiagram.reduceToMimimumSize(); + if( !bUseFixedInnerSize ) + aVDiagram.reduceToMimimumSize(); } uno::Reference< drawing::XShapes > xTextTargetShapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxes_Shapes) ); @@ -1410,19 +1420,21 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo //calculate resulting size respecting axis label layout and fontscaling + uno::Reference< drawing::XShape > xBoundingShape( xDiagramPlusAxes_Shapes, uno::UNO_QUERY ); + ::basegfx::B2IRectangle aConsumedOuterRect; + //use first coosys only so far; todo: calculate for more than one coosys if we have more in future //todo: this is just a workaround at the moment for pie and donut labels - if( !lcl_resizeAfterCompleteCreation(xDiagram) && rVCooSysList.size() > 0 ) + bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram); + if( !bIsPieOrDonut && rVCooSysList.size() > 0 ) { - uno::Reference< drawing::XShape > xBoundingShape( xDiagramPlusAxes_Shapes, uno::UNO_QUERY ); - - ::basegfx::B2IRectangle aFirstConsumedOuterRect( ShapeFactory::getRectangleOfShape(xBoundingShape) ); - VCoordinateSystem* pVCooSys = rVCooSysList[0]; pVCooSys->createMaximumAxesLabels(); - ::basegfx::B2IRectangle aConsumedOuterRect( ShapeFactory::getRectangleOfShape(xBoundingShape) ); - ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.adjustInnerSize( aConsumedOuterRect ) ); + aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) ); + ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() ); + if( !bUseFixedInnerSize ) + aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect ); pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aNewInnerRect ) )); @@ -1445,13 +1457,13 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo bLessSpaceConsumedThanExpected = true; } - if( bLessSpaceConsumedThanExpected ) + if( bLessSpaceConsumedThanExpected && !bUseFixedInnerSize ) { aVDiagram.adjustInnerSize( aConsumedOuterRect ); pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) )); - pVCooSys->updatePositions(); } + pVCooSys->updatePositions();//todo: logically this belongs to the condition above, but it seems also to be neccessary to give the axes group shapes the right bounding rects for hit test - probably caused by bug i106183 -> check again if fixed } //create axes and grids for the final size @@ -1481,7 +1493,7 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo else { xSeriesTarget = xSeriesTargetBehindAxis; - DBG_ASSERT( !lcl_resizeAfterCompleteCreation(xDiagram), "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" ); + DBG_ASSERT( !bIsPieOrDonut, "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" ); } pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,m_xShapeFactory,aCID ); pSeriesPlotter->setPageReferenceSize( rPageSize ); @@ -1500,15 +1512,15 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo m_bPointsWereSkipped = m_bPointsWereSkipped || pSeriesPlotter->PointsWereSkipped(); } - //recreate with corrected sizes if requested - if( lcl_resizeAfterCompleteCreation(xDiagram) ) + //recreate all with corrected sizes if requested + if( bIsPieOrDonut ) { m_bPointsWereSkipped = false; - uno::Reference< drawing::XShape > xBoundingShape( xDiagramPlusAxes_Shapes, uno::UNO_QUERY ); - ::basegfx::B2IRectangle aConsumedOuterRect( ShapeFactory::getRectangleOfShape(xBoundingShape) ); - - ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.adjustInnerSize( aConsumedOuterRect ) ); + aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) ); + ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() ); + if( !bUseFixedInnerSize ) + aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect ); for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ ) { @@ -1565,6 +1577,63 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo pSeriesPlotter->rearrangeLabelToAvoidOverlapIfRequested( rPageSize ); } } + + if( bUseFixedInnerSize ) + { + //if( !bIsPieOrDonut ) + // aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) ); + aUsedOuterRect = awt::Rectangle( aConsumedOuterRect.getMinX(), aConsumedOuterRect.getMinY(), aConsumedOuterRect.getWidth(), aConsumedOuterRect.getHeight() ); + } + else + aUsedOuterRect = awt::Rectangle( rAvailablePos.X, rAvailablePos.Y, rAvailableSize.Width, rAvailableSize.Height ); + + bool bSnapRectToUsedArea = false; + for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ ) + { + VSeriesPlotter* pSeriesPlotter = *aPlotterIter; + bSnapRectToUsedArea = pSeriesPlotter->shouldSnapRectToUsedArea(); + if(bSnapRectToUsedArea) + break; + } + if(bSnapRectToUsedArea) + { + if( bUseFixedInnerSize ) + m_aResultingDiagramRectangleExcludingAxes = getRectangleOfObject( C2U("PlotAreaExcludingAxes") ); + else + { + ::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle(); + m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( aConsumedInnerRect.getMinX(), aConsumedInnerRect.getMinY(), aConsumedInnerRect.getWidth(), aConsumedInnerRect.getHeight() ); + } + } + else + { + if( bUseFixedInnerSize ) + m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( rAvailablePos.X, rAvailablePos.Y, rAvailableSize.Width, rAvailableSize.Height ); + else + { + ::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle(); + m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( aConsumedInnerRect.getMinX(), aConsumedInnerRect.getMinY(), aConsumedInnerRect.getWidth(), aConsumedInnerRect.getHeight() ); + } + } + + if( xDiagram_MarkHandles.is() ) + { + awt::Point aPos(rAvailablePos); + awt::Size aSize(rAvailableSize); + bool bPosSizeExcludeAxesProperty = true; + uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY_THROW ); + if( xDiaProps.is() ) + xDiaProps->getPropertyValue(C2U("PosSizeExcludeAxes")) >>= bPosSizeExcludeAxesProperty; + if( bUseFixedInnerSize || bPosSizeExcludeAxesProperty ) + { + aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y ); + aSize = awt::Size( m_aResultingDiagramRectangleExcludingAxes.Width, m_aResultingDiagramRectangleExcludingAxes.Height ); + } + xDiagram_MarkHandles->setPosition( aPos ); + xDiagram_MarkHandles->setSize( aSize ); + } + + return aUsedOuterRect; } //------------------------------------------------------------- @@ -1622,6 +1691,12 @@ uno::Reference< drawing::XShape > ChartView::getShapeForCID( const rtl::OUString return 0; } +awt::Rectangle ChartView::getDiagramRectangleExcludingAxes() +{ + impl_updateView(); + return m_aResultingDiagramRectangleExcludingAxes; +} + awt::Rectangle ChartView::getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect ) { impl_updateView(); @@ -1645,7 +1720,10 @@ awt::Rectangle ChartView::getRectangleOfObject( const rtl::OUString& rObjectCID, SdrObjList* pRootList = pRootSdrObject->GetSubList(); if( pRootList ) { - SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( C2U("MarkHandles"), pRootList ); + OUString aShapeName = C2U("MarkHandles"); + if( eObjectType == OBJECTTYPE_DIAGRAM ) + aShapeName = C2U("PlotAreaIncludingAxes"); + SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList ); if( pShape ) xShape = uno::Reference< drawing::XShape >( pShape->getUnoShape(), uno::UNO_QUERY); } @@ -1933,12 +2011,12 @@ sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabe } //static -awt::Rectangle ExplicitValueProvider::calculateDiagramPositionAndSizeInclusiveTitle( +awt::Rectangle ExplicitValueProvider::addAxisTitleSizes( const Reference< frame::XModel >& xChartModel , const Reference< uno::XInterface >& xChartView - , const awt::Rectangle& rExclusivePositionAndSize ) + , const awt::Rectangle& rExcludingPositionAndSize ) { - awt::Rectangle aRet(rExclusivePositionAndSize); + awt::Rectangle aRet(rExcludingPositionAndSize); //add axis title sizes to the diagram size uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xChartModel ) ); @@ -2000,6 +2078,74 @@ awt::Rectangle ExplicitValueProvider::calculateDiagramPositionAndSizeInclusiveTi return aRet; } +//static +awt::Rectangle ExplicitValueProvider::substractAxisTitleSizes( + const Reference< frame::XModel >& xChartModel + , const Reference< uno::XInterface >& xChartView + , const awt::Rectangle& rPositionAndSizeIncludingTitles ) +{ + awt::Rectangle aRet(rPositionAndSizeIncludingTitles); + + //add axis title sizes to the diagram size + uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xChartModel ) ); + uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xChartModel ) ); + uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xChartModel ) ); + uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xChartModel ) ); + if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() ) + { + ExplicitValueProvider* pExplicitValueProvider = ExplicitValueProvider::getExplicitValueProvider(xChartView); + if( pExplicitValueProvider ) + { + //detect wether x axis points into x direction or not + if( lcl_getPropertySwapXAndYAxis( ChartModelHelper::findDiagram( xChartModel ) ) ) + { + std::swap( xTitle_Height, xTitle_Width ); + std::swap( xSecondTitle_Height, xSecondTitle_Width ); + } + + sal_Int32 nTitleSpaceWidth = 0; + sal_Int32 nTitleSpaceHeight = 0; + sal_Int32 nSecondTitleSpaceWidth = 0; + sal_Int32 nSecondTitleSpaceHeight = 0; + + if( xTitle_Height.is() ) + { + rtl::OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, xChartModel ) ); + nTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height; + if( nTitleSpaceHeight ) + nTitleSpaceHeight+=lcl_getDiagramTitleSpace(); + } + if( xTitle_Width.is() ) + { + rtl::OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, xChartModel ) ); + nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width; + if(nTitleSpaceWidth) + nTitleSpaceWidth+=lcl_getDiagramTitleSpace(); + } + if( xSecondTitle_Height.is() ) + { + rtl::OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, xChartModel ) ); + nSecondTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height; + if( nSecondTitleSpaceHeight ) + nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace(); + } + if( xSecondTitle_Width.is() ) + { + rtl::OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, xChartModel ) ); + nSecondTitleSpaceWidth += pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width; + if( nSecondTitleSpaceWidth ) + nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace(); + } + + aRet.X += nTitleSpaceWidth; + aRet.Y += nSecondTitleSpaceHeight; + aRet.Width -= (nTitleSpaceWidth + nSecondTitleSpaceWidth); + aRet.Height -= (nTitleSpaceHeight + nSecondTitleSpaceHeight); + } + } + return aRet; +} + double lcl_getPageLayoutDistancePercentage() { return 0.02; @@ -2010,9 +2156,10 @@ bool getAvailablePosAndSizeForDiagram( , const awt::Rectangle& rSpaceLeft , const awt::Size & rPageSize , const uno::Reference< XDiagram > & xDiagram - , VTitle* pXTitle, VTitle* pYTitle - , VTitle* pSecondXTitle, VTitle* pSecondYTitle ) + , bool& bUseFixedInnerSize ) { + bUseFixedInnerSize = false; + //@todo: we need a size dependent on the axis labels awt::Rectangle aRemainingSpace(rSpaceLeft); { @@ -2028,7 +2175,9 @@ bool getAvailablePosAndSizeForDiagram( uno::Reference< beans::XPropertySet > xProp(xDiagram, uno::UNO_QUERY); - bool bMakeRoomForTitle = false; + bool bPosSizeExcludeAxes = false; + if( xProp.is() ) + xProp->getPropertyValue( C2U( "PosSizeExcludeAxes" ) ) >>= bPosSizeExcludeAxes; //size: ::com::sun::star::chart2::RelativeSize aRelativeSize; @@ -2036,7 +2185,7 @@ bool getAvailablePosAndSizeForDiagram( { rOutAvailableDiagramSize.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*rPageSize.Height); rOutAvailableDiagramSize.Width = static_cast<sal_Int32>(aRelativeSize.Primary*rPageSize.Width); - bMakeRoomForTitle = true; + bUseFixedInnerSize = bPosSizeExcludeAxes; } else rOutAvailableDiagramSize = awt::Size(aRemainingSpace.Width,aRemainingSpace.Height); @@ -2054,7 +2203,7 @@ bool getAvailablePosAndSizeForDiagram( rOutPos = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY)) , rOutAvailableDiagramSize, aRelativePosition.Anchor ); - bMakeRoomForTitle = true; + bUseFixedInnerSize = bPosSizeExcludeAxes; } else rOutPos = awt::Point(aRemainingSpace.X,aRemainingSpace.Y); @@ -2067,52 +2216,6 @@ bool getAvailablePosAndSizeForDiagram( rOutAvailableDiagramSize.Width = rPageSize.Width - rOutPos.X; } - if( bMakeRoomForTitle ) - { - sal_Int32 nTitleSpaceWidth = 0; - sal_Int32 nTitleSpaceHeight = 0; - sal_Int32 nSecondTitleSpaceWidth = 0; - sal_Int32 nSecondTitleSpaceHeight = 0; - { - //todo detect wether x axis points into x direction or not - //detect wether x axis points into x direction or not - if( lcl_getPropertySwapXAndYAxis( xDiagram ) ) - { - std::swap( pXTitle, pYTitle ); - std::swap( pSecondXTitle, pSecondYTitle ); - } - - if( pXTitle ) - { - nTitleSpaceHeight = pXTitle->getFinalSize().Height; - if(nTitleSpaceHeight) - nTitleSpaceHeight+=lcl_getDiagramTitleSpace(); - } - if( pYTitle ) - { - nTitleSpaceWidth = pYTitle->getFinalSize().Width; - if(nTitleSpaceWidth) - nTitleSpaceWidth+=lcl_getDiagramTitleSpace(); - } - if( pSecondXTitle) - { - nSecondTitleSpaceHeight += pSecondXTitle->getFinalSize().Height; - if(nSecondTitleSpaceHeight) - nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace(); - } - if( pSecondYTitle) - { - nSecondTitleSpaceWidth += pSecondYTitle->getFinalSize().Width; - if(nSecondTitleSpaceWidth) - nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace(); - } - } - rOutAvailableDiagramSize.Height -= nTitleSpaceHeight + nSecondTitleSpaceHeight; - rOutAvailableDiagramSize.Width -= nTitleSpaceWidth + nSecondTitleSpaceWidth; - rOutPos.X += nTitleSpaceWidth; - rOutPos.Y += nSecondTitleSpaceHeight; - } - return true; } @@ -2154,6 +2257,19 @@ void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment break; } + sal_Int32 nMaxY = rPageSize.Height - aTitleSize.Height/2; + sal_Int32 nMaxX = rPageSize.Width - aTitleSize.Width/2; + sal_Int32 nMinX = aTitleSize.Width/2; + sal_Int32 nMinY = aTitleSize.Height/2; + if( aNewPosition.Y > nMaxY ) + aNewPosition.Y = nMaxY; + if( aNewPosition.X > nMaxX ) + aNewPosition.X = nMaxX; + if( aNewPosition.Y < nMinY ) + aNewPosition.Y = nMinY; + if( aNewPosition.X < nMinX ) + aNewPosition.X = nMinX; + pVTitle->changePosition( aNewPosition ); } @@ -2478,6 +2594,7 @@ void ChartView::createShapes() if( impl_AddInDrawsAllByItself() ) return; + m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle(0,0,0,0); impl_deleteCoordinateSystems(); if( m_pDrawModelWrapper ) { @@ -2519,9 +2636,15 @@ void ChartView::createShapes() uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) ); rtl::OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) ) );//todo: other index if more than one diagram is possible uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes( ShapeFactory(m_xShapeFactory).createGroup2D(xPageShapes,aDiagramCID) ); - uno::Reference< drawing::XShape > xDiagramPlusAxes_MarkHandles( ShapeFactory(m_xShapeFactory).createInvisibleRectangle( + + uno::Reference< drawing::XShape > xDiagram_MarkHandles( ShapeFactory(m_xShapeFactory).createInvisibleRectangle( + xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) ); + ShapeFactory::setShapeName( xDiagram_MarkHandles, C2U("MarkHandles") ); + + uno::Reference< drawing::XShape > xDiagram_OuterRect( ShapeFactory(m_xShapeFactory).createInvisibleRectangle( xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) ); - ShapeFactory::setShapeName( xDiagramPlusAxes_MarkHandles, C2U("MarkHandles") ); + ShapeFactory::setShapeName( xDiagram_OuterRect, C2U("PlotAreaIncludingAxes") ); + uno::Reference< drawing::XShapes > xDiagramPlusAxes_Shapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes ) ); //------------ create some titles @@ -2606,21 +2729,22 @@ void ChartView::createShapes() //------------ create complete diagram shape (inclusive axis and series) awt::Point aAvailablePosDia; awt::Size aAvailableSizeForDiagram; - if( getAvailablePosAndSizeForDiagram( aAvailablePosDia, aAvailableSizeForDiagram, aRemainingSpace, aPageSize, ChartModelHelper::findDiagram( m_xChartModel ) - , apVTitle_X.get(), apVTitle_Y.get(), apVTitle_SecondX.get(), apVTitle_SecondY.get() ) ) + bool bUseFixedInnerSize = false; + if( getAvailablePosAndSizeForDiagram( aAvailablePosDia, aAvailableSizeForDiagram, aRemainingSpace, aPageSize + , ChartModelHelper::findDiagram( m_xChartModel ), bUseFixedInnerSize ) ) { - impl_createDiagramAndContent( aSeriesPlotterContainer + awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent( aSeriesPlotterContainer , xDiagramPlusAxes_Shapes - , aAvailablePosDia ,aAvailableSizeForDiagram, aPageSize ); + , aAvailablePosDia ,aAvailableSizeForDiagram, aPageSize, bUseFixedInnerSize, xDiagram_MarkHandles ); - if(xDiagramPlusAxes_MarkHandles.is()) + if( xDiagram_OuterRect.is() ) { - xDiagramPlusAxes_MarkHandles->setPosition( aAvailablePosDia ); - xDiagramPlusAxes_MarkHandles->setSize( aAvailableSizeForDiagram ); + xDiagram_OuterRect->setPosition( awt::Point( aUsedOuterRect.X, aUsedOuterRect.Y ) ); + xDiagram_OuterRect->setSize( awt::Size( aUsedOuterRect.Width, aUsedOuterRect.Height ) ); } //correct axis title position - awt::Rectangle aDiagramPlusAxesRect(aAvailablePosDia.X,aAvailablePosDia.Y,aAvailableSizeForDiagram.Width,aAvailableSizeForDiagram.Height); + awt::Rectangle aDiagramPlusAxesRect( aUsedOuterRect ); if(bAutoPosition_XTitle) changePositionOfAxisTitle( apVTitle_X.get(), ALIGN_BOTTOM, aDiagramPlusAxesRect, aPageSize ); if(bAutoPosition_YTitle) @@ -2691,17 +2815,6 @@ void ChartView::impl_updateView() //create chart view { - /* - ::vos::OGuard aGuard( Application::GetSolarMutex()); - while( m_bViewDirty ) - { - createShapes(); - m_bViewDirty = m_bViewUpdatePending; - m_bViewUpdatePending = false; - m_bInViewUpdate = false; - } - */ - m_bViewDirty = false; m_bViewUpdatePending = false; createShapes(); @@ -2871,6 +2984,14 @@ void SAL_CALL ChartView::removeModeChangeApproveListener( const uno::Reference< void SAL_CALL ChartView::update() throw (uno::RuntimeException) { impl_updateView(); + + //#i100778# migrate all imported or old documents to a plot area sizing exclusive axes (in case the save settings allow for this): + //Although in general it is a bad idea to change the model from within the view this is exceptionally the best place to do this special conversion. + //When a view update is requested (what happens for creating the metafile or displaying + //the chart in edit mode or printing) it is most likely that all necessary informations are available - like the underlying spreadsheet data for example. + //Those data is important for the correct axis lable sizes which are needed during conversion. + if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_xChartModel, true, false ) ) + impl_updateView(); } // ____ XPropertySet ____ diff --git a/chart2/source/view/main/ChartView.hxx b/chart2/source/view/main/ChartView.hxx index f56da298c5df..476adae03674 100644 --- a/chart2/source/view/main/ChartView.hxx +++ b/chart2/source/view/main/ChartView.hxx @@ -110,6 +110,8 @@ public: virtual ::com::sun::star::awt::Rectangle getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false ); + virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes(); + ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper(); // ___XTransferable___ @@ -196,11 +198,13 @@ private: //methods void impl_updateView(); - void impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer + ::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes , const ::com::sun::star::awt::Point& rAvailablePos , const ::com::sun::star::awt::Size& rAvailableSize - , const ::com::sun::star::awt::Size& rPageSize ); + , const ::com::sun::star::awt::Size& rPageSize + , bool bUseFixedInnerSize + , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xDiagram_MarkHandles ); private: //member @@ -246,6 +250,8 @@ private: //member sal_Int32 m_nScaleYDenominator; sal_Bool m_bSdrViewIsInEditMode; + + ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes; }; //............................................................................. diff --git a/config.sub b/config.sub index 0f84ac2c51e2..c2d125724c0e 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. -timestamp='2004-11-30' +timestamp='2010-01-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,22 +22,26 @@ timestamp='2004-11-30' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -70,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -83,11 +89,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +105,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,8 +124,10 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -145,10 +153,13 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -170,6 +181,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -186,6 +201,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -230,22 +249,28 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64vr | mips64vrel \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ @@ -254,30 +279,40 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ + | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ | v850 | v850e \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) + m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -297,28 +332,32 @@ case $basic_machine in | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ @@ -327,26 +366,35 @@ case $basic_machine in | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ + | mt-* \ | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile-* | tilegx-* \ | tron-* \ + | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -410,6 +458,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -418,10 +470,26 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -450,8 +518,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -489,6 +557,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -643,6 +715,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -654,10 +734,17 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze) + basic_machine=microblaze-xilinx + ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -683,6 +770,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -758,9 +848,8 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff ;; os400) basic_machine=powerpc-ibm @@ -782,6 +871,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -791,6 +888,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -847,6 +950,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -873,6 +980,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -884,6 +995,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -973,6 +1087,15 @@ case $basic_machine in basic_machine=tic6x-unknown os=-coff ;; + # This must be matched before tile*. + tilegx*) + basic_machine=tilegx-unknown + os=-linux-gnu + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -1048,6 +1171,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1086,13 +1213,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1139,6 +1263,9 @@ case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1159,26 +1286,30 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1196,7 +1327,7 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) @@ -1308,6 +1439,11 @@ case $os in -zvmoe) os=-zvmoe ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; -none) ;; *) @@ -1330,6 +1466,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1339,9 +1481,9 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1367,6 +1509,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1385,6 +1530,9 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; @@ -1493,7 +1641,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) @@ -1556,7 +1704,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/configure.in b/configure.in index cf2a97402135..0f658c8cbde6 100644 --- a/configure.in +++ b/configure.in @@ -944,7 +944,7 @@ case "$build_os" in AC_MSG_ERROR([only sparc and i386 processors are supported]) fi ;; - linux-gnu*) + linux-gnu*|k*bsd*-gnu*) test_gtk=yes test_cairo=yes test_kde=yes @@ -2394,7 +2394,13 @@ dnl =================================================================== if test "$_os" = "Linux"; then case "$build_cpu" in i?86) - DEFAULT_TO_STLPORT="yes" + case "$build_os" in k*bsd*-gnu*) + DEFAULT_TO_STLPORT="no" + ;; + *) + DEFAULT_TO_STLPORT="yes" + ;; + esac ;; *) DEFAULT_TO_STLPORT="no" diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index d243ce96f27c..6a2962716f27 100644..100755 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -473,7 +473,7 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG ) } else { - if( SvtLinguConfig().HasAnyVendorImages() ) + if( SvtLinguConfig().HasVendorImages( "SpellAndGrammarDialogImage" ) ) { pThis->aVendorImageFI.Show(); Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 91136b607a22..16026aaff6d1 100644..100755 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -28,52 +28,51 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cui.hxx" -// include --------------------------------------------------------------- -#include <tools/shl.hxx> -#include <tools/list.hxx> -#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> -#include <vcl/msgbox.hxx> -#include "cuires.hrc" -#include "hyphen.hrc" -#include <editeng/svxenum.hxx> #include "hyphen.hxx" +#include "hyphen.hrc" +#include "cuires.hrc" +#include "dialmgr.hxx" + #include <editeng/splwrap.hxx> -#include <svx/dlgutil.hxx> -#include <svx/dialmgr.hxx> +#include <editeng/svxenum.hxx> #include <editeng/unolingu.hxx> #include <svtools/langtab.hxx> -#include "dialmgr.hxx" +#include <svx/dialmgr.hxx> +#include <svx/dlgutil.hxx> +#include <tools/list.hxx> +#include <tools/shl.hxx> +#include <vcl/msgbox.hxx> -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; +#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) +using namespace ::com::sun::star; -// define ---------------------------------------------------------------- -#define HYPHHERE '-' +#define HYPH_POS_CHAR '=' #define CONTINUE_HYPH USHRT_MAX -// Dies ist nur ein Hack, weil an dieser Stelle das extern char aus hmwrap -// nicht bekannt ist, wird demnaechst in hmwrap durch ein define ersetzt. -#define SW_SOFT_HYPHEN '=' +#define CUR_HYPH_POS_CHAR '-' + + +// class HyphenEdit_Impl ------------------------------------------------------- -// class SvxHyphenEdit --------------------------------------------------- +class HyphenEdit_Impl : public Edit +{ +public: + HyphenEdit_Impl( Window* pParent, const ResId& rResId ); + +protected: + virtual void KeyInput( const KeyEvent &rKEvt ); +}; -SvxHyphenEdit::SvxHyphenEdit( Window* pParent, const ResId& rResId ) : +HyphenEdit_Impl::HyphenEdit_Impl( Window* pParent, const ResId& rResId ) : Edit( pParent, rResId ) { } -// ----------------------------------------------------------------------- -void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) +void HyphenEdit_Impl::KeyInput( const KeyEvent& rKEvt ) { // sal_uInt16 nMod = rKEvt.GetKeyCode().GetModifier(); sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); @@ -99,123 +98,143 @@ void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) } } -// class SvxHyphenWordDialog --------------------------------------------- -SvxHyphenWordDialog::SvxHyphenWordDialog( const String &rWord, LanguageType nLang, - Window* pParent, - Reference< XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ), - - aWordFT ( this, CUI_RES( FT_WORD ) ), - aWordEdit ( this, CUI_RES( ED_WORD ) ), - aLeftBtn ( this, CUI_RES( BTN_LEFT ) ), - aRightBtn ( this, CUI_RES( BTN_RIGHT ) ), - aOkBtn ( this, CUI_RES( BTN_HYPH_CUT ) ), - aCancelBtn ( this, CUI_RES( BTN_HYPH_CANCEL ) ), - aContBtn ( this, CUI_RES( BTN_HYPH_CONTINUE ) ), - aDelBtn ( this, CUI_RES( BTN_HYPH_DELETE ) ), - aHelpBtn ( this, CUI_RES( BTN_HYPH_HELP ) ), - aLabel ( GetText() ), - pHyphWrapper ( pWrapper ), - xHyphenator ( xHyphen ), - aActWord ( rWord ), - nActLanguage ( nLang ), +// struct SvxHyphenWordDialog_Impl --------------------------------------------- + +struct SvxHyphenWordDialog_Impl +{ + SvxHyphenWordDialog * m_pDialog; +// Window * m_pParent; + + FixedText aWordFT; + HyphenEdit_Impl aWordEdit; + ImageButton aLeftBtn; + ImageButton aRightBtn; + OKButton aOkBtn; + PushButton aContBtn; + PushButton aDelBtn; + FixedLine aFLBottom; + HelpButton aHelpBtn; + PushButton aHyphAll; + CancelButton aCancelBtn; + String aLabel; + SvxSpellWrapper* pHyphWrapper; + uno::Reference< linguistic2::XHyphenator > xHyphenator; + uno::Reference< linguistic2::XPossibleHyphens > xPossHyph; + String aEditWord; // aEditWord and aWordEdit.GetText() differ only by the character for the current selected hyphenation position + String aActWord; // actual word to be hyphenated + LanguageType nActLanguage; // and its language + sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos + sal_uInt16 nHyphPos; + sal_uInt16 nOldPos; + sal_Int32 nHyphenationPositionsOffset; + sal_Bool bBusy; + + + void EnableLRBtn_Impl(); + String EraseUnusableHyphens_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 nMaxHyphenationPos ); + + void InitControls_Impl(); + void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); + sal_uInt16 GetHyphIndex_Impl(); + void SelLeft_Impl(); + void SelRight_Impl(); + + DECL_LINK( Left_Impl, Button* ); + DECL_LINK( Right_Impl, Button* ); + DECL_LINK( CutHdl_Impl, Button* ); + DECL_LINK( ContinueHdl_Impl, Button* ); + DECL_LINK( DeleteHdl_Impl, Button* ); + DECL_LINK( HyphenateAllHdl_Impl, Button* ); + DECL_LINK( CancelHdl_Impl, Button* ); + DECL_LINK( GetFocusHdl_Impl, Edit* ); + + + SvxHyphenWordDialog_Impl( + SvxHyphenWordDialog * pDialog, + const String &rWord, + LanguageType nLang, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ); + ~SvxHyphenWordDialog_Impl(); +}; + + +SvxHyphenWordDialog_Impl::SvxHyphenWordDialog_Impl( + SvxHyphenWordDialog * pDialog, + const String &rWord, + LanguageType nLang, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + m_pDialog ( pDialog ), + aWordFT ( pDialog, CUI_RES( FT_WORD ) ), + aWordEdit ( pDialog, CUI_RES( ED_WORD ) ), + aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), + aRightBtn ( pDialog, CUI_RES( BTN_RIGHT ) ), + aOkBtn ( pDialog, CUI_RES( BTN_HYPH_CUT ) ), + aContBtn ( pDialog, CUI_RES( BTN_HYPH_CONTINUE ) ), + aDelBtn ( pDialog, CUI_RES( BTN_HYPH_DELETE ) ), + aFLBottom ( pDialog, CUI_RES( FL_BOTTOM ) ), + aHelpBtn ( pDialog, CUI_RES( BTN_HYPH_HELP ) ), + aHyphAll ( pDialog, CUI_RES( BTN_HYPH_ALL ) ), + aCancelBtn ( pDialog, CUI_RES( BTN_HYPH_CANCEL ) ), + aLabel ( pDialog->GetText() ), + pHyphWrapper ( NULL ), + xHyphenator ( NULL ), + xPossHyph ( NULL ), + aActWord ( ), + nActLanguage ( LANGUAGE_NONE ), + nMaxHyphenationPos ( 0 ), nHyphPos ( 0 ), nOldPos ( 0 ), + nHyphenationPositionsOffset( 0 ), bBusy ( sal_False ) { - aContBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) ); - aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) ); - aCancelBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) ); - aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) ); - aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) ); - - aWordEdit.SetGetFocusHdl( - LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) ); - - Reference< XHyphenatedWord > xHyphWord( pWrapper ? - pWrapper->GetLast() : Reference< XInterface > () , UNO_QUERY ); - DBG_ASSERT(xHyphWord.is(), "missing hyphenated word"); - nMaxHyphenationPos = xHyphWord.is() ? xHyphWord->getHyphenationPos() : 0; - SetLabel_Impl( nLang ); + aActWord = rWord; + nActLanguage = nLang; + xHyphenator = xHyphen; + pHyphWrapper = pWrapper; + + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper ? + pHyphWrapper->GetLast() : NULL, uno::UNO_QUERY ); + DBG_ASSERT( xHyphWord.is(), "hyphenation result missing" ); + if (xHyphWord.is()) + { + DBG_ASSERT( aActWord == String( xHyphWord->getWord() ), "word mismatch" ); + DBG_ASSERT( nActLanguage == SvxLocaleToLanguage( xHyphWord->getLocale() ), "language mismatch" ); + nMaxHyphenationPos = xHyphWord->getHyphenationPos(); + } InitControls_Impl(); aWordEdit.GrabFocus(); - FreeResource(); - - // disable controls if service is not available - if (!xHyphenator.is()) - Enable( sal_False ); + aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Left_Impl ) ); + aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Right_Impl ) ); + aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CutHdl_Impl ) ); + aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, ContinueHdl_Impl ) ); + aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, DeleteHdl_Impl ) ); + aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl ) ); + aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CancelHdl_Impl ) ); + aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog_Impl, GetFocusHdl_Impl ) ); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::SelLeft() +SvxHyphenWordDialog_Impl::~SvxHyphenWordDialog_Impl() { - String aTxt( aWordEdit.GetText() ); - - for ( xub_StrLen i = nOldPos + 1; i-- > 0 ; ) - { - DBG_ASSERT(i <= aTxt.Len(), "index out of range"); - if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) - { - aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); -} - -// ----------------------------------------------------------------------- - -void SvxHyphenWordDialog::SelRight() -{ - String aTxt( aWordEdit.GetText() ); - - for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) - { - if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) - { - aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::EnableLRBtn_Impl() +void SvxHyphenWordDialog_Impl::EnableLRBtn_Impl() { - String aTxt( aWordEdit.GetText() ); + String aTxt( aEditWord ); xub_StrLen nLen = aTxt.Len(); xub_StrLen i; aRightBtn.Disable(); for ( i = nOldPos + 2; i < nLen; ++i ) { - if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) + if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) { aRightBtn.Enable(); break; @@ -228,7 +247,7 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() aLeftBtn.Disable(); for ( i = nOldPos; i-- > 0; ) { - if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) + if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) { aLeftBtn.Enable(); break; @@ -236,42 +255,55 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() } } -// ----------------------------------------------------------------------- - -void SvxHyphenWordDialog::SetLabel_Impl( LanguageType nLang ) -{ - String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); - String aTmp( aLabel ); - aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); - aTmp.Append( aLangStr ); - aTmp.Append( sal_Unicode( ')' ) ); - SetText( aTmp ); -} - -// ----------------------------------------------------------------------- - -String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( - Reference< XPossibleHyphens > &rxPossHyph, +String SvxHyphenWordDialog_Impl::EraseUnusableHyphens_Impl( + uno::Reference< linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 _nMaxHyphenationPos ) { // returns a String showing only those hyphen positions which will result // in a line break if hyphenation is done there + // 1) we will need to discard all hyphenation positions at th end that + // will not result in a line break where the text to the left still fits + // on the line. + // 2) since as from OOo 3.2 '-' are part of a word an thus text like + // 'multi-line-editor' is regarded as single word we also need to discard those + // hyphenation positions to the left of the rightmost '-' that is still left of + // the rightmost valid hyphenation position according to 1) + // + // Example: + // If the possible hyphenation position in 'multi-line-editor' are to eb marked + // by '=' then the text will look like this 'mul=ti-line-ed=it=or'. + // If now the first line is only large enough for 'multi-line-edi' we need to discard + // the last possible hyphnation point because of 1). The the right most valid + // hyphenation position is "ed=itor". The first '-' left of this position is + // "line-ed", thus because of 2) we now need to discard all possible hyphneation + // positions to the left of that as well. Thus in the end leaving us with just + // 'multi-line-ed=itor' as return value for this function. (Just one valid hyphenation + // position for the user too choose from. However ALL the '-' characters in the word + // will ALWAYS be valid implicit hyphenation positions for the core to choose from! + // And thus even if this word is skipped in the hyphenation dialog it will still be broken + // right after 'multi-line-' (actually it might already be broken up that way before + // the hyphenation dialog is called!). + // Thus rule 2) just eliminates those positions which will not be used by the core at all + // even if the user were to select one of them. String aTxt; DBG_ASSERT(rxPossHyph.is(), "missing possible hyphens"); if (rxPossHyph.is()) { + DBG_ASSERT( aActWord == String( rxPossHyph->getWord() ), "word mismatch" ); + aTxt = String( rxPossHyph->getPossibleHyphens() ); - Sequence< sal_Int16 > aHyphenationPositions( + nHyphenationPositionsOffset = 0; + uno::Sequence< sal_Int16 > aHyphenationPositions( rxPossHyph->getHyphenationPositions() ); sal_Int32 nLen = aHyphenationPositions.getLength(); const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray(); // find position nIdx after which all hyphen positions are unusable - xub_StrLen nIdx = STRING_NOTFOUND, - nPos; + xub_StrLen nIdx = STRING_NOTFOUND; + xub_StrLen nPos = 0, nPos1 = 0, nPos2 = 0; if (nLen) { xub_StrLen nStart = 0; @@ -282,7 +314,7 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( else { // find corresponding hyphen pos in string - nPos = aTxt.Search( sal_Unicode( SW_SOFT_HYPHEN ), nStart ); + nPos = aTxt.Search( sal_Unicode( HYPH_POS_CHAR ), nStart ); if (nStart == STRING_NOTFOUND) break; @@ -296,66 +328,77 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( } DBG_ASSERT(nIdx != STRING_NOTFOUND, "no usable hyphenation position"); - // remove not usable hyphens from string + // 1) remove all not usable hyphenation positions from the end of the string nPos = nIdx == STRING_NOTFOUND ? 0 : nIdx + 1; - String aTmp( sal_Unicode( SW_SOFT_HYPHEN ) ), - aEmpty; + nPos1 = nPos; //save for later use in 2) below + const String aTmp( sal_Unicode( HYPH_POS_CHAR ) ); + const String aEmpty; while (nPos != STRING_NOTFOUND) nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); + + // 2) remove all hyphenation positions from the start that are not considered by the core + const String aSearchRange( aTxt.Copy( 0, nPos1 ) ); + nPos2 = aSearchRange.SearchBackward( '-' ); // the '-' position the core will use by default + if (nPos2 != STRING_NOTFOUND) + { + String aLeft( aSearchRange.Copy( 0, nPos2 ) ); + nPos = 0; + while (nPos != STRING_NOTFOUND) + { + nPos = aLeft.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); + if (nPos != STRING_NOTFOUND) + ++nHyphenationPositionsOffset; + } + aTxt.Replace( 0, nPos2, aLeft ); + } } return aTxt; } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::InitControls_Impl() +void SvxHyphenWordDialog_Impl::InitControls_Impl() { - String aTxt; xPossHyph = NULL; if (xHyphenator.is()) { lang::Locale aLocale( SvxCreateLocale(nActLanguage) ); xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale, - Sequence< PropertyValue >() ); + uno::Sequence< beans::PropertyValue >() ); if (xPossHyph.is()) - { - aTxt = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); - } - SetLabel_Impl( nActLanguage ); + aEditWord = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); } - aWordEdit.SetText( aTxt ); + aWordEdit.SetText( aEditWord ); - nOldPos = aTxt.Len(); - SelLeft(); + nOldPos = aEditWord.Len(); + SelLeft_Impl(); EnableLRBtn_Impl(); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) +void SvxHyphenWordDialog_Impl::ContinueHyph_Impl( sal_uInt16 nInsPos ) { if ( nInsPos != CONTINUE_HYPH && xPossHyph.is()) { if (nInsPos) { - //String aTmp( U2S( xPossHyph->getPossibleHyphens() ) ); - String aTmp( aWordEdit.GetText() ); + String aTmp( aEditWord ); DBG_ASSERT(nInsPos <= aTmp.Len() - 2, "wrong hyphen position"); - sal_uInt16 nIdxPos = 0; - sal_uInt16 i = 0; - sal_Unicode c; - while (i < aTmp.Len() && HYPHHERE != (c = aTmp.GetChar(i++)) ) + sal_Int16 nIdxPos = -1; + for (sal_uInt16 i = 0; i <= nInsPos; ++i) { - if (SW_SOFT_HYPHEN == c) + if (HYPH_POS_CHAR == aTmp.GetChar( i )) nIdxPos++; } + // take the possible hyphenation positions that got removed from the + // start of the wor dinot account: + nIdxPos += nHyphenationPositionsOffset; - Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); + uno::Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); sal_Int32 nLen = aSeq.getLength(); DBG_ASSERT(nLen, "empty sequence"); - DBG_ASSERT(nIdxPos < nLen, "index out of range"); - if (nLen && nIdxPos < nLen) + DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen, "index out of range"); + if (nLen && 0 <= nIdxPos && nIdxPos < nLen) { nInsPos = aSeq.getConstArray()[ nIdxPos ]; pHyphWrapper->InsertHyphen( nInsPos ); @@ -370,58 +413,130 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) if ( pHyphWrapper->FindSpellError() ) { - Reference< XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), UNO_QUERY ); + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), uno::UNO_QUERY ); // adapt actual word and language to new found hyphenation result if(xHyphWord.is()) { - aActWord = String( xHyphWord->getWord() ); + aActWord = String( xHyphWord->getWord() ); nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); nMaxHyphenationPos = xHyphWord->getHyphenationPos(); InitControls_Impl(); + m_pDialog->SetWindowTitle( nActLanguage ); } } else - EndDialog( RET_OK ); + m_pDialog->EndDialog( RET_OK ); } -// ----------------------------------------------------------------------- -sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl() +sal_uInt16 SvxHyphenWordDialog_Impl::GetHyphIndex_Impl() { sal_uInt16 nPos = 0; - String aTxt(aWordEdit.GetText()); + String aTxt( aWordEdit.GetText() ); for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i ) { - sal_Unicode nChar = aTxt.GetChar( i ); - - if ( nChar == HYPHHERE ) + sal_Unicode cChar = aTxt.GetChar( i ); + if ( cChar == CUR_HYPH_POS_CHAR ) break; - - if ( nChar != SW_SOFT_HYPHEN ) + if ( cChar != HYPH_POS_CHAR ) nPos++; } return nPos; } -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) +void SvxHyphenWordDialog_Impl::SelLeft_Impl() +{ + DBG_ASSERT( nOldPos > 0, "invalid hyphenation position" ); + if (nOldPos > 0) + { + String aTxt( aEditWord ); + for ( xub_StrLen i = nOldPos - 1; i > 0; --i) + { + DBG_ASSERT(i <= aTxt.Len(), "index out of range"); + if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) + { + aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); + + nOldPos = i; + aWordEdit.SetText( aTxt ); + aWordEdit.GrabFocus(); + aWordEdit.SetSelection( Selection( i, i + 1 ) ); + break; + } + } + nHyphPos = GetHyphIndex_Impl(); + EnableLRBtn_Impl(); + } +} + + +void SvxHyphenWordDialog_Impl::SelRight_Impl() +{ + String aTxt( aEditWord ); + for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) + { + if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) + { + aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); + + nOldPos = i; + aWordEdit.SetText( aTxt ); + aWordEdit.GrabFocus(); + aWordEdit.SetSelection( Selection( i, i + 1 ) ); + break; + } + } + nHyphPos = GetHyphIndex_Impl(); + EnableLRBtn_Impl(); +} + + +IMPL_LINK( SvxHyphenWordDialog_Impl, CutHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - ContinueHyph_Impl( nHyphPos ); + ContinueHyph_Impl( /*nHyphPos*/nOldPos ); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl, Button *, EMPTYARG /*pButton*/ ) +{ + if( !bBusy ) + { + try + { + uno::Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); + const rtl::OUString aName( rtl::OUString::createFromAscii( "IsHyphAuto" ) ); + uno::Any aAny; + + aAny <<= sal_True; + xProp->setPropertyValue( aName, aAny ); + + bBusy = sal_True; + ContinueHyph_Impl( /*nHyphPos*/nOldPos ); + bBusy = sal_False; + + aAny <<= sal_False; + xProp->setPropertyValue( aName, aAny ); + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "Hyphenate All failed" ); + } + } + return 0; +} + + +IMPL_LINK( SvxHyphenWordDialog_Impl, DeleteHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { @@ -431,11 +546,9 @@ IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, ContinueHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { @@ -445,69 +558,100 @@ IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYAR } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, CancelHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; pHyphWrapper->SpellEnd(); - EndDialog( RET_CANCEL ); + m_pDialog->EndDialog( RET_CANCEL ); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, Left_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - SelLeft(); + SelLeft_Impl(); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, Right_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - SelRight(); + SelRight_Impl(); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, GetFocusHdl_Impl, Edit *, EMPTYARG ) { aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) ); return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK( SvxHyphenWordDialog, LangError_Impl, void *, nLang ) +// class SvxHyphenWordDialog --------------------------------------------- + +SvxHyphenWordDialog::SvxHyphenWordDialog( + const String &rWord, LanguageType nLang, + Window* pParent, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ) { - // Status anzeigen - String aErr( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_IntPtr)nLang ) ); - aErr += CUI_RESSTR( RID_SVXSTR_HMERR_CHECKINSTALL ); - InfoBox( this, aErr ).Execute(); - return 0; + m_pImpl = std::auto_ptr< SvxHyphenWordDialog_Impl >( + new SvxHyphenWordDialog_Impl( this, rWord, nLang, xHyphen, pWrapper ) ); + + FreeResource(); + + SetWindowTitle( nLang ); + + // disable controls if service is not available + if (!m_pImpl->xHyphenator.is()) + Enable( sal_False ); +} + + +SvxHyphenWordDialog::~SvxHyphenWordDialog() +{ +} + + +void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang ) +{ + String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); + String aTmp( m_pImpl->aLabel ); + aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); + aTmp.Append( aLangStr ); + aTmp.Append( sal_Unicode( ')' ) ); + SetText( aTmp ); +} + + +void SvxHyphenWordDialog::SelLeft() +{ + m_pImpl->SelRight_Impl(); +} + + +void SvxHyphenWordDialog::SelRight() +{ + m_pImpl->SelLeft_Impl(); } diff --git a/cui/source/dialogs/hyphen.hrc b/cui/source/dialogs/hyphen.hrc index 2c6722298655..f76e2aa75770 100644..100755 --- a/cui/source/dialogs/hyphen.hrc +++ b/cui/source/dialogs/hyphen.hrc @@ -33,13 +33,14 @@ #define BTN_LEFT 11 #define BTN_RIGHT 12 #define FT_WORD 13 +#define FL_BOTTOM 14 #define BTN_HYPH_CONTINUE 20 #define BTN_HYPH_DELETE 21 #define BTN_HYPH_CUT 22 #define BTN_HYPH_CANCEL 23 #define BTN_HYPH_HELP 24 - +#define BTN_HYPH_ALL 25 #endif diff --git a/cui/source/dialogs/hyphen.src b/cui/source/dialogs/hyphen.src index 71720867fcc9..f10e94626f31 100644..100755 --- a/cui/source/dialogs/hyphen.src +++ b/cui/source/dialogs/hyphen.src @@ -40,104 +40,87 @@ String RID_SVXSTR_HMERR_CHECKINSTALL ModalDialog RID_SVXDLG_HYPHENATE { HelpId = HID_HYPHENATE ; - Size = MAP_APPFONT ( 188 , 100 ) ; + Size = MAP_APPFONT ( 200 , 111 ) ; OutputSize = TRUE ; SvLook = TRUE ; Text [ en-US ] = "Hyphenation" ; Moveable = TRUE ; + + FixedText FT_WORD + { + Pos = MAP_APPFONT ( 5 , 5 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "~Word" ; + }; Edit ED_WORD { BORDER = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 17 ) ; + Size = MAP_APPFONT ( 132 , 12 ) ; TABSTOP = TRUE ; LEFT = TRUE ; }; ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 6 , 33 ) ; + Pos = MAP_APPFONT ( 56 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; ImageButton BTN_RIGHT { - Pos = MAP_APPFONT ( 22 , 33 ) ; + Pos = MAP_APPFONT ( 75 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; Symbol = IMAGEBUTTON_ARROW_RIGHT ; }; - FixedText FT_WORD + OKButton BTN_HYPH_CUT { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 144 , 17 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "H~yphenate" ; + TABSTOP = TRUE ; + DEFBUTTON = TRUE ; }; PushButton BTN_HYPH_CONTINUE { - Pos = MAP_APPFONT ( 132 , 43 ) ; + Pos = MAP_APPFONT ( 144 , 35 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Next" ; + Text [ en-US ] = "~Skip" ; TABSTOP = TRUE ; }; PushButton BTN_HYPH_DELETE { - Pos = MAP_APPFONT ( 132 , 60 ) ; + Pos = MAP_APPFONT ( 144 , 52 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; Text [ en-US ] = "~Remove" ; TABSTOP = TRUE ; }; - OKButton BTN_HYPH_CUT + FixedLine FL_BOTTOM + { + Pos = MAP_APPFONT ( 0 , 81 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + }; + HelpButton BTN_HYPH_HELP { - Pos = MAP_APPFONT ( 132 , 6 ) ; + Pos = MAP_APPFONT ( 5 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Hyphenate" ; TABSTOP = TRUE ; - DEFBUTTON = TRUE ; }; - CancelButton BTN_HYPH_CANCEL + PushButton BTN_HYPH_ALL { - Pos = MAP_APPFONT ( 132 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 63 , 93 ) ; + Size = MAP_APPFONT ( 74 , 14 ) ; + Text [ en-US ] = "Hyphenate ~All" ; TABSTOP = TRUE ; }; - HelpButton BTN_HYPH_HELP + CancelButton BTN_HYPH_CANCEL { - Pos = MAP_APPFONT ( 132 , 80 ) ; + Pos = MAP_APPFONT ( 144 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Close"; TABSTOP = TRUE ; }; }; - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index c1a96541c5b7..bf617b126747 100644..100755 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -26,10 +26,21 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove + #include "precompiled_cui.hxx" +#include "thesdlg.hrc" +#include "thesdlg.hxx" +#include "thesdlg_impl.hxx" +#include "cuires.hrc" +#include "dialmgr.hxx" + +#include <editeng/unolingu.hxx> #include <tools/shl.hxx> #include <svl/lngmisc.hxx> +#include <svtools/filter.hxx> +#include <svtools/svlbitm.hxx> +#include <svtools/svtreebx.hxx> #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> @@ -39,25 +50,28 @@ #include <svx/dlgutil.hxx> #include <svx/dialmgr.hxx> #include <svx/svxerr.hxx> -#include "cuires.hrc" -#include "thesdlg.hrc" #include <editeng/unolingu.hxx> #include <svx/langbox.hxx> #include <svtools/langtab.hxx> -#include "dialmgr.hxx" -#include <svx/dialogs.hrc> -#include <editeng/editerr.hxx> +#include <unotools/lingucfg.hxx> +#include <i18npool/mslangid.hxx> +#include <comphelper/processfactory.hxx> +#include <osl/file.hxx> + + +#include <stack> +#include <algorithm> + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; +using ::rtl::OUString; + + +#define A2S(x) String::CreateFromAscii( x ) -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) // GetReplaceEditString ------------------------------- @@ -89,171 +103,237 @@ static void GetReplaceEditString( String &rText ) rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); } -// struct ThesDlg_Impl --------------------------------------------------- +// class LookUpComboBox_Impl -------------------------------------------------- -struct ThesDlg_Impl +LookUpComboBox_Impl::LookUpComboBox_Impl( + Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : + ComboBox (pParent, rResId), + m_rDialogImpl( rImpl ) { - Reference< XThesaurus > xThesaurus; - ::rtl::OUString aLookUpText; - sal_Int16 nLookUpLanguage; + m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); + m_aModifyTimer.SetTimeout( 500 ); + + EnableAutocomplete( FALSE ); +} - ThesDlg_Impl( Reference< XThesaurus > & xThes ); - SfxErrorContext* pErrContext; // ErrorContext, - // w"ahrend der Dialog oben ist -}; -ThesDlg_Impl::ThesDlg_Impl(Reference< XThesaurus > & xThes) : - xThesaurus (xThes) +LookUpComboBox_Impl::~LookUpComboBox_Impl() { - pErrContext = NULL; - nLookUpLanguage = LANGUAGE_NONE; } -// class SvxThesaurusLanguageDlg_Impl ------------------------------------ +void LookUpComboBox_Impl::Modify() +{ + m_aModifyTimer.Start(); +} + -class SvxThesaurusLanguageDlg_Impl : public ModalDialog +IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) { -private: - SvxLanguageBox aLangLB; - FixedLine aLangFL; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; + m_rDialogImpl.LookUp( GetText() ); + m_aModifyTimer.Stop(); + return 0; +} - DECL_LINK( DoubleClickHdl_Impl, ListBox * ); -public: - SvxThesaurusLanguageDlg_Impl( Window* pParent ); +// class ReplaceEdit_Impl -------------------------------------------------- - sal_uInt16 GetLanguage() const; - void SetLanguage( sal_uInt16 nLang ); -}; +ReplaceEdit_Impl::ReplaceEdit_Impl( + Window *pParent, const ResId &rResId ) : + Edit (pParent, rResId) +{ +} -// ----------------------------------------------------------------------- +ReplaceEdit_Impl::~ReplaceEdit_Impl() +{ +} -SvxThesaurusLanguageDlg_Impl::SvxThesaurusLanguageDlg_Impl( Window* pParent ) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_THES_LANGUAGE ) ), +void ReplaceEdit_Impl::Modify() +{ + if (m_pBtn) + m_pBtn->Enable( GetText().Len() > 0 ); +} - aLangLB ( this, CUI_RES( LB_THES_LANGUAGE ) ), - aLangFL ( this, CUI_RES( FL_THES_LANGUAGE ) ), - aOKBtn ( this, CUI_RES( BTN_LANG_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_LANG_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_LANG_HELP ) ) +void ReplaceEdit_Impl::SetText( const XubString& rStr ) { - FreeResource(); + Edit::SetText( rStr ); + Modify(); +} - aLangLB.SetLanguageList( LANG_LIST_THES_USED, FALSE, FALSE ); - aLangLB.SetDoubleClickHdl( - LINK( this, SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl ) ); + +void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) +{ + Edit::SetText( rStr, rNewSelection ); + Modify(); } -// ----------------------------------------------------------------------- +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- -sal_uInt16 SvxThesaurusLanguageDlg_Impl::GetLanguage() const +void AlternativesString_Impl::Paint( + const Point& rPos, + SvLBox& rDev, USHORT, + SvLBoxEntry* pEntry ) { - sal_uInt16 nLang = aLangLB.GetSelectLanguage(); - return nLang; + AlternativesUserData_Impl* pData = (AlternativesUserData_Impl*)pEntry->GetUserData(); + Point aPos( rPos ); + Font aOldFont( rDev.GetFont()); + if (pData && pData->IsHeader()) + { + Font aFont( aOldFont ); + aFont.SetWeight( WEIGHT_BOLD ); + rDev.SetFont( aFont ); + aPos.X() = 0; + } + else + aPos.X() += 5; + rDev.DrawText( aPos, GetText() ); + rDev.SetFont( aOldFont ); } -// ----------------------------------------------------------------------- -void SvxThesaurusLanguageDlg_Impl::SetLanguage( sal_uInt16 nLang ) +ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( + Window* pParent, + SvxThesaurusDialog_Impl &rImpl ) : + SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), + m_rDialogImpl( rImpl ) { - aLangLB.SelectLanguage( nLang ); + SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + SetHighlightRange(); } -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl, ListBox *, EMPTYARG ) +ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() { - EndDialog( RET_OK ); - return 0; + ClearUserData(); } -IMPL_LINK_INLINE_END( SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl, ListBox *, EMPTYARG ) -// class SvxThesaurusDialog ---------------------------------------------- +void ThesaurusAlternativesCtrl_Impl::ClearUserData() +{ + for (USHORT i = 0; i < GetEntryCount(); ++i) + delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); +} -// ----------------------------------------------------------------------- - - -SvxThesaurusDialog::SvxThesaurusDialog( Window* pParent, Reference< XThesaurus > xThes, - const String &rWord, sal_Int16 nLanguage) : - - SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ), - - aWordText ( this, CUI_RES( FT_WORD ) ), - aWordLB ( this, CUI_RES( LB_WORD ) ), - aReplaceText( this, CUI_RES( FT_REPL ) ), - aReplaceEdit( this, CUI_RES( ED_REPL ) ), - aMeanText ( this, CUI_RES( FT_MEAN ) ), - aMeanLB ( this, CUI_RES( LB_MEAN ) ), - aSynonymText( this, CUI_RES( FT_SYNON ) ), - aSynonymLB ( this, CUI_RES( LB_SYNON ) ), - aVarFL ( this, CUI_RES( FL_VAR ) ), - aOkBtn ( this, CUI_RES( BTN_THES_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_THES_CANCEL ) ), - aLookUpBtn ( this, CUI_RES( BTN_LOOKUP ) ), - aLangBtn ( this, CUI_RES( BTN_LANGUAGE ) ), - aHelpBtn ( this, CUI_RES( BTN_THES_HELP ) ), - aErrStr ( CUI_RES( STR_ERR_WORDNOTFOUND ) ) -{ - pImpl = new ThesDlg_Impl( xThes ); - pImpl->aLookUpText = ::rtl::OUString( rWord ); - pImpl->nLookUpLanguage = nLanguage; - pImpl->pErrContext = - new SfxErrorContext( ERRCTX_SVX_LINGU_THESAURUS, String(), this, - RID_SVXERRCTX, &DIALOG_MGR() ); - - aLangBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); - aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LookUpHdl_Impl ) ); - aMeanLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, EntryHdl_Impl ) ); - aSynonymLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, SynonymHdl_Impl ) ); - Link aLink = LINK( this, SvxThesaurusDialog, SelectHdl_Impl ); - aMeanLB.SetDoubleClickHdl( aLink ); - aSynonymLB.SetDoubleClickHdl( aLink ); - aWordLB.SetSelectHdl( aLink ); - FreeResource(); +SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + String aText; + if (bIsHeader && nVal >= 0) + { + aText = String::CreateFromInt32( nVal ); + aText += A2S( ". " ); + } + pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column + aText += rText; + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash + pEntry->AddItem( new AlternativesString_Impl( pEntry, 0, aText ) ); - ::rtl::OUString aTmp( rWord ); - linguistic::RemoveHyphens( aTmp ); - linguistic::ReplaceControlChars( aTmp ); - aReplaceEdit.SetText( aTmp ); - aWordLB.InsertEntry( aTmp ); - aWordLB.SelectEntry( aTmp ); + AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); + pEntry->SetUserData( pUserData ); + GetModel()->Insert( pEntry ); - Init_Impl( nLanguage ); + if (bIsHeader) + GetViewDataEntry( pEntry )->SetSelectable( false ); - // disable controls if service is missing - if (!pImpl->xThesaurus.is()) - Enable( sal_False ); + return pEntry; } -// ----------------------------------------------------------------------- +void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) +{ + const KeyCode& rKey = rKEvt.GetKeyCode(); + + if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) + GetParent()->KeyInput( rKEvt ); // parent will close dialog... + else if (rKey.GetCode() == KEY_SPACE) + m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry + else if (GetEntryCount()) + SvxCheckListBox::KeyInput( rKEvt ); +} -SvxThesaurusDialog::~SvxThesaurusDialog() + +void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) +{ + if (!m_rDialogImpl.m_bWordFound) + { +/* Push( PUSH_FONT ); + + Font aFont( GetFont() ); + aFont.SetHeight( 2 * aFont.GetHeight() ); + SetFont( aFont ); +*/ + Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); + aTextSize = LogicToPixel( aTextSize ); + Point aPos; + aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; + aPos.Y() += GetSizePixel().Height() / 2 /*- aTextSize.Height() / 2*/; + aPos = PixelToLogic( aPos ); + DrawText( aPos, m_rDialogImpl.aErrStr ); + +// Pop(); + } + else + SvxCheckListBox::Paint( rRect ); +} + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : + m_pDialog ( pDialog ), + aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ), + aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), + aWordText ( pDialog, CUI_RES( FT_WORD ) ), + aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ), + m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ), + m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ), + aReplaceText ( pDialog, CUI_RES( FT_REPL ) ), + aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ), + aFL ( pDialog, CUI_RES( FL_VAR ) ), + aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ), + aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ), + aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ), + aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), + aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), + aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), + aVendorDefaultImageHC ( CUI_RES( IMG_DEFAULT_VENDOR_HC ) ), + xThesaurus ( NULL ), + aLookUpText (), + nLookUpLanguage ( LANGUAGE_NONE ), + m_bWordFound( false ) +{ + // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog + + aReplaceEdit.SetButton( &aReplaceBtn ); + + aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); + aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); + aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); + m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); + m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); + + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); +} + + +SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() { - delete pImpl->pErrContext; - delete pImpl; + delete aLangMBtn.GetPopupMenu(); } -// ----------------------------------------------------------------------- -uno::Sequence< Reference< XMeaning > > SAL_CALL - SvxThesaurusDialog::queryMeanings_Impl( - ::rtl::OUString& rTerm, - const Locale& rLocale, - const beans::PropertyValues& rProperties ) - throw(lang::IllegalArgumentException, uno::RuntimeException) +uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( + OUString& rTerm, + const lang::Locale& rLocale, + const beans::PropertyValues& rProperties ) + throw(lang::IllegalArgumentException, uno::RuntimeException) { - uno::Sequence< Reference< XMeaning > > aMeanings( - pImpl->xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( + xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); // text with '.' at the end? if (0 == aMeanings.getLength() && rTerm.getLength() && @@ -263,7 +343,7 @@ uno::Sequence< Reference< XMeaning > > SAL_CALL // end of a sentence and not an abbreviation... String aTxt( rTerm ); aTxt.EraseTrailingChars( '.' ); - aMeanings = pImpl->xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); + aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); if (aMeanings.getLength()) { rTerm = aTxt; @@ -273,220 +353,394 @@ uno::Sequence< Reference< XMeaning > > SAL_CALL return aMeanings; } -// ----------------------------------------------------------------------- -sal_uInt16 SvxThesaurusDialog::GetLanguage() const +bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() { - return pImpl->nLookUpLanguage; + lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( + aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); + const sal_Int32 nMeanings = aMeanings.getLength(); + const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); + + m_pAlternativesCT->SetUpdateMode( FALSE ); + + // clear old user data of control before creating new ones via AddEntry below + m_pAlternativesCT->ClearUserData(); + + m_pAlternativesCT->Clear(); + for (sal_Int32 i = 0; i < nMeanings; ++i) + { + OUString rMeaningTxt = pMeanings[i]->getMeaning(); + uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() ); + const sal_Int32 nSynonyms = aSynonyms.getLength(); + const OUString *pSynonyms = aSynonyms.getConstArray(); + DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); + DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); + + m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); + for (sal_Int32 k = 0; k < nSynonyms; ++k) + m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); + } + + m_pAlternativesCT->SetUpdateMode( TRUE ); + + return nMeanings > 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::UpdateMeaningBox_Impl( uno::Sequence< Reference< XMeaning > > *pMeaningSeq ) +void SvxThesaurusDialog_Impl::LookUp( const String &rText ) { - // create temporary meaning list if not supplied from somewhere else - sal_Bool bTmpSeq = sal_False; - if (!pMeaningSeq && pImpl->xThesaurus.is()) - { - bTmpSeq = sal_True; - lang::Locale aLocale( SvxCreateLocale( pImpl->nLookUpLanguage ) ); - uno::Sequence< Reference< XMeaning > > aTmpMean = queryMeanings_Impl( - pImpl->aLookUpText, aLocale, Sequence< PropertyValue >() ); + if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same + aWordCB.SetText( rText ); + LookUp_Impl(); +} - pMeaningSeq = new Sequence< Reference< XMeaning > > ( aTmpMean ); - // set new replace edit text if a different look up text was used - // see: queryMeanings_Impl - aReplaceEdit.SetText( pImpl->aLookUpText ); +IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) +{ + if (pBtn && aLookUpHistory.size() >= 2) + { + aLookUpHistory.pop(); // remove current look up word from stack + aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word + aLookUpHistory.pop(); + LookUp_Impl(); } + return 0; +} - sal_Int32 nMeaningCount = pMeaningSeq ? pMeaningSeq->getLength() : 0; - const Reference< XMeaning > *pMeaning = pMeaningSeq ? pMeaningSeq->getConstArray() : NULL; - aMeanLB.Clear(); - for ( sal_Int32 i = 0; i < nMeaningCount; ++i ) - aMeanLB.InsertEntry( pMeaning[i]->getMeaning() ); - - // remove temporary meaning list - if (bTmpSeq) - delete pMeaningSeq; - if (aMeanLB.GetEntryCount() > 0) - aMeanLB.SelectEntryPos(0); - UpdateSynonymBox_Impl(); +IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) +{ + PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); + if (pMenu && pBtn) + { + USHORT nItem = pBtn->GetCurItemId(); + String aLangText( pMenu->GetItemText( nItem ) ); + LanguageType nLang = SvtLanguageTable().GetType( aLangText ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) + nLookUpLanguage = nLang; + m_pDialog->SetWindowTitle( nLang ); + UpdateVendorImage(); + LookUp_Impl(); + } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::UpdateSynonymBox_Impl() +void SvxThesaurusDialog_Impl::LookUp_Impl() { + String aText( aWordCB.GetText() ); + + aLookUpText = OUString( aText ); + if (aLookUpText.getLength() > 0 && + (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top())) + aLookUpHistory.push( aLookUpText ); + + m_bWordFound = UpdateAlternativesBox_Impl(); + m_pAlternativesCT->Enable( m_bWordFound ); - aSynonymLB.Clear(); + if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) + aWordCB.InsertEntry( aText ); - sal_uInt16 nPos = aMeanLB.GetSelectEntryPos(); // active meaning pos - if (nPos != LISTBOX_ENTRY_NOTFOUND && pImpl->xThesaurus.is()) + aReplaceEdit.SetText( String() ); + aLeftBtn.Enable( aLookUpHistory.size() > 1 ); +} + + +IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) +{ + if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys { - // get Reference< XMeaning > for selected meaning - lang::Locale aLocale( SvxCreateLocale( pImpl->nLookUpLanguage ) ); - Reference< XMeaning > xMeaning = queryMeanings_Impl( - pImpl->aLookUpText, aLocale, Sequence< PropertyValue >() ) - .getConstArray()[ nPos ]; - - uno::Sequence< ::rtl::OUString > aSynonyms; - if (xMeaning.is()) - aSynonyms = xMeaning->querySynonyms(); - - sal_Int32 nSynonymCount = aSynonyms.getLength(); - const ::rtl::OUString *pSynonym = aSynonyms.getConstArray(); - for ( sal_Int32 i=0; i < nSynonymCount; ++i ) - aSynonymLB.InsertEntry( pSynonym[i] ); + USHORT nPos = pBox->GetSelectEntryPos(); + String aStr( pBox->GetEntry( nPos ) ); + GetReplaceEditString( aStr ); + aWordCB.SetText( aStr ); + LookUp_Impl(); } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::Apply() +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) { + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; + if (pEntry) + { + AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } + aReplaceEdit.SetText( aStr ); + } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::Init_Impl(sal_Int16 nLanguage) + +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) { - // Sprache anpassen - String aStr( GetText() ); - aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); - aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); - //aStr += GetLanguageString( (LanguageType)pImpl->pThesaurus->GetLanguage() ); - aStr += SvtLanguageTable::GetLanguageString( (LanguageType) nLanguage ); - aStr.Append( sal_Unicode( ')' ) ); - SetText( aStr ); // Text der Window-Leiste setzen (Wort + Sprache) + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; + if (pEntry) + { + AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } - // adapt meanings according to (new) language - UpdateMeaningBox_Impl(); + aWordCB.SetText( aStr ); + if (aStr.Len() > 0) + LookUp_Impl(); + } + + //! workaround to set the selection since calling SelectEntryPos within + //! the double click handler does not work + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); + return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { + (void) pThis; + if (pBox && pBox->GetEntryCount() > 0) + pBox->SelectEntryPos( 0 ); + return 0; +} - EnterWait(); +//////////////////////////////////////////////////////////// - String aText( aReplaceEdit.GetText() ); +static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) +{ + Image aRes; + + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} - ::rtl::OUString aOldLookUpText = pImpl->aLookUpText; - pImpl->aLookUpText = ::rtl::OUString( aText ); - uno::Sequence< Reference< XMeaning > > aMeanings; - if (pImpl->xThesaurus.is()) - aMeanings = queryMeanings_Impl( - pImpl->aLookUpText, - SvxCreateLocale( pImpl->nLookUpLanguage ), - Sequence< PropertyValue >() ); +static String lcl_GetThesImplName( const lang::Locale &rLocale ) +{ + String aRes; - LeaveWait(); - if ( aMeanings.getLength() == 0 ) + uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; + try { - if( pBtn == &aCancelBtn ) // called via double click - { - pImpl->aLookUpText = aOldLookUpText; - } - else + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); + + DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); + if (xLngMgr.is()) { - UpdateMeaningBox_Impl( &aMeanings ); - if( pBtn == &aLookUpBtn ) - InfoBox( this, aErrStr ).Execute(); + uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( + OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; } - return 0; + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); } - UpdateMeaningBox_Impl( &aMeanings ); + return aRes; +} - if ( aWordLB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) - aWordLB.InsertEntry( aText ); - aWordLB.SelectEntry( aText ); - aMeanLB.SelectEntryPos( 0 ); +void SvxThesaurusDialog_Impl::UpdateVendorImage() +{ + m_pDialog->SetUpdateMode( sal_False ); - String aStr( aMeanLB.GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); - aSynonymLB.SetNoSelection(); + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) + { + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); - return 0; + Image aImage; + String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); + OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName, bHC ) ); + if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) + aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); + else + aImage = bHC ? aVendorDefaultImageHC : aVendorDefaultImage; + aVendorImageFI.SetImage( aImage ); + } + + m_pDialog->SetUpdateMode( sal_True ); } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, Button *, EMPTYARG ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) { - if (!pImpl->xThesaurus.is()) - return 0; + pThis->m_pDialog->SetUpdateMode( sal_False ); - SvxThesaurusLanguageDlg_Impl aDlg( this ); - sal_uInt16 nLang = pImpl->nLookUpLanguage; - aDlg.SetLanguage( nLang ); - - if ( aDlg.Execute() == RET_OK ) + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) { - nLang = aDlg.GetLanguage(); - if (pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - pImpl->nLookUpLanguage = nLang; - UpdateMeaningBox_Impl(); - Init_Impl( nLang ); + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + Image aImage( bHC ? pThis->aVendorDefaultImageHC : pThis->aVendorDefaultImage ); + pThis->aVendorImageFI.SetImage( aImage ); + pThis->aVendorImageFI.Show(); + + // move down visible controls according to the vendor images height + Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); + Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); + if (aImageSize.Height()) + { + aVendorSize.Height() = aImageSize.Height(); + if(aVendorSize.Width() < aImageSize.Width()) + aVendorSize.Width() = aImageSize.Width(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + } + const sal_Int32 nDiff = aVendorSize.Height(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + Control* aControls[] = { + &pThis->aLeftBtn, + &pThis->aWordText, + &pThis->aWordCB, + &pThis->m_aAlternativesText, + pThis->m_pAlternativesCT.get(), + &pThis->aReplaceText, + &pThis->aReplaceEdit, + &pThis->aFL, + &pThis->aHelpBtn, + &pThis->aLangMBtn, + &pThis->aReplaceBtn, + &pThis->aCancelBtn, + 0 + }; + sal_Int32 nControl = 0; + while (aControls[nControl]) + { + Point aPos = aControls[nControl]->GetPosPixel(); + aPos.Y() += nDiff; + aControls[nControl]->SetPosPixel(aPos); + ++nControl; + } + Size aDlgSize = pThis->m_pDialog->GetSizePixel(); + aDlgSize.Height() += nDiff; + pThis->m_pDialog->SetSizePixel( aDlgSize ); + pThis->m_pDialog->Invalidate(); } + pThis->UpdateVendorImage(); + pThis->m_pDialog->SetUpdateMode( sal_True ); + return 0; -} +}; -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SynonymHdl_Impl, ListBox *, EMPTYARG ) +// class SvxThesaurusDialog ---------------------------------------------- + +SvxThesaurusDialog::SvxThesaurusDialog( + Window* pParent, + uno::Reference< linguistic2::XThesaurus > xThes, + const String &rWord, + LanguageType nLanguage ) : + + SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ) { - if ( aSynonymLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + m_pImpl = std::auto_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); + + m_pImpl->xThesaurus = xThes; + m_pImpl->aLookUpText = OUString( rWord ); + m_pImpl->nLookUpLanguage = nLanguage; + if (rWord.Len() > 0) + m_pImpl->aLookUpHistory.push( rWord ); + + FreeResource(); + + OUString aTmp( rWord ); + linguistic::RemoveHyphens( aTmp ); + linguistic::ReplaceControlChars( aTmp ); + String aTmp2( aTmp ); + m_pImpl->aReplaceEdit.SetText( aTmp2 ); + m_pImpl->aWordCB.InsertEntry( aTmp2 ); + + m_pImpl->LookUp( aTmp2 ); + m_pImpl->m_pAlternativesCT->GrabFocus(); + m_pImpl->aLeftBtn.Enable( sal_False ); + + // fill language menu button list + SvtLanguageTable aLangTab; + uno::Sequence< lang::Locale > aLocales; + if (m_pImpl->xThesaurus.is()) + aLocales = m_pImpl->xThesaurus->getLocales(); + const sal_Int32 nLocales = aLocales.getLength(); + const lang::Locale *pLocales = aLocales.getConstArray(); + delete m_pImpl->aLangMBtn.GetPopupMenu(); + PopupMenu* pMenu = new PopupMenu; + pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); + std::vector< OUString > aLangVec; + for (sal_Int32 i = 0; i < nLocales; ++i ) { - String aStr( aSynonymLB.GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); + const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + aLangVec.push_back( aLangTab.GetString( nLang ) ); } - return 0; + std::sort( aLangVec.begin(), aLangVec.end() ); + for (size_t i = 0; i < aLangVec.size(); ++i) + pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 + m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); + + SetWindowTitle( nLanguage ); + + // disable controls if service is missing + if (!m_pImpl->xThesaurus.is()) + Enable( sal_False ); } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SelectHdl_Impl, ListBox *, pBox ) +SvxThesaurusDialog::~SvxThesaurusDialog() { - String aStr( pBox->GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); +} - //! 'aCancelBtn' is used to indicate that the handler is called as result - //! of a double click action. - LookUpHdl_Impl( &aCancelBtn /* ??? &aLookUpBtn */ ); - return 0; +void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) +{ + // Sprache anpassen + String aStr( GetText() ); + aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); + aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); + aStr += SvtLanguageTable().GetLanguageString( nLanguage ); + aStr.Append( sal_Unicode( ')' ) ); + SetText( aStr ); // set window title } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, EntryHdl_Impl, ListBox *, EMPTYARG ) +String SvxThesaurusDialog::GetWord() { + return m_pImpl->aReplaceEdit.GetText(); +} - UpdateSynonymBox_Impl(); - return 0; +sal_uInt16 SvxThesaurusDialog::GetLanguage() const +{ + return m_pImpl->nLookUpLanguage; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SpellErrorHdl_Impl, void *, pError ) +void SvxThesaurusDialog::Apply() { - // Der "ubergebene Pointer pError ist die falsche Sprachen-Nummer - LanguageType eLang = (LanguageType)(sal_uIntPtr)pError; - String aErr( SvtLanguageTable::GetLanguageString( eLang ) ); - // Fehlermeldung ausgeben - ErrorHandler::HandleError( - *new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) ); - return 0; } + diff --git a/cui/source/dialogs/thesdlg.hrc b/cui/source/dialogs/thesdlg.hrc index 9621422a1894..994c933246de 100644..100755 --- a/cui/source/dialogs/thesdlg.hrc +++ b/cui/source/dialogs/thesdlg.hrc @@ -29,30 +29,23 @@ // defines --------------------------------------------------------------- +#define BTN_LEFT 9 #define BTN_THES_OK 10 #define BTN_THES_CANCEL 11 -#define BTN_LANGUAGE 12 +#define MB_LANGUAGE 12 #define BTN_THES_HELP 13 -#define BTN_LOOKUP 14 #define FT_WORD 15 -#define LB_WORD 16 -#define FT_MEAN 17 -#define LB_MEAN 18 -#define FT_SYNON 19 -#define LB_SYNON 20 +#define CB_WORD 16 #define FT_REPL 21 #define ED_REPL 22 -#define FL_VAR 23 - -#define STR_ERR_WORDNOTFOUND 30 - -// LanguageDialog -------------------------------------------------------- - -#define LB_THES_LANGUAGE 10 -#define FL_THES_LANGUAGE 11 -#define BTN_LANG_OK 12 -#define BTN_LANG_CANCEL 12 -#define BTN_LANG_HELP 13 +#define FL_VAR 23 +#define FT_THES_ALTERNATIVES 24 +#define CT_THES_ALTERNATIVES 25 +#define IMG_VENDOR 26 +#define IMG_DEFAULT_VENDOR 27 +#define IMG_DEFAULT_VENDOR_HC 28 + +#define STR_ERR_TEXTNOTFOUND 101 #endif diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src index c7caa659b1c0..16d724473d20 100644..100755 --- a/cui/source/dialogs/thesdlg.src +++ b/cui/source/dialogs/thesdlg.src @@ -24,185 +24,123 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - // include --------------------------------------------------------------- + #include "cuires.hrc" #include "thesdlg.hrc" #include "helpid.hrc" #include <svx/svxids.hrc> // SID_THESAURUS -// pragma ---------------------------------------------------------------- // RID_SVXDLG_THES ------------------------------------------------------- ModalDialog RID_SVXDLG_THESAURUS { HelpId = SID_THESAURUS ; OutputSize = TRUE ; - Size = MAP_APPFONT ( 285 , 116 ) ; + Size = MAP_APPFONT ( 235, 230 ) ; Text [ en-US ] = "Thesaurus" ; - Moveable = TRUE ; SvLook = TRUE ; - OkButton BTN_THES_OK - { - Pos = MAP_APPFONT ( 219 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_THES_CANCEL - { - Pos = MAP_APPFONT ( 219 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - PushButton BTN_LOOKUP + Moveable = TRUE ; + + FixedImage IMG_VENDOR { - Pos = MAP_APPFONT ( 219 , 40 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Search" ; + Pos = MAP_APPFONT ( 0, 0 ) ; + Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime + Hide = TRUE; }; - PushButton BTN_LANGUAGE + + ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 219 , 57 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language..." ; - }; - HelpButton BTN_THES_HELP - { - Pos = MAP_APPFONT ( 219 , 77 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; + Pos = MAP_APPFONT ( 5 , 15 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + TABSTOP = TRUE ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; FixedText FT_WORD { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 24 , 5 ) ; + Size = MAP_APPFONT ( 143 , 8 ) ; + Text [ en-US ] = "Current ~word" ; LEFT = TRUE ; }; - ListBox LB_WORD + ComboBox CB_WORD { DropDown = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 96 , 65 ) ; + Pos = MAP_APPFONT ( 24 , 16 ) ; + Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines }; - FixedText FT_MEAN + MenuButton MB_LANGUAGE { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Meaning " ; - LEFT = TRUE ; - }; - ListBox LB_MEAN - { - BORDER = TRUE ; - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; - AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( 170 , 16 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Language" ; }; - FixedText FT_SYNON + + FixedText FT_THES_ALTERNATIVES { - Pos = MAP_APPFONT ( 111 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "Sy~nonym" ; + Pos = MAP_APPFONT ( 5 , 33 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; + Text [ en-US ] = "~Alternatives" ; LEFT = TRUE ; }; - ListBox LB_SYNON + Control CT_THES_ALTERNATIVES { - BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; - AutoHScroll = TRUE ; + HelpID = HID_CT_THES_ALTERNATIVES ; // also needed for automatic testing to find the control + Pos = MAP_APPFONT ( 5 , 45 ) ; + Size = MAP_APPFONT ( 225 , 121 ) ; + Border = TRUE; + TabStop = TRUE ; }; + FixedText FT_REPL { - Pos = MAP_APPFONT ( 111 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Replace" ; + Pos = MAP_APPFONT ( 5 , 173 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; + Text [ en-US ] = "Replace ~with" ; LEFT = TRUE ; }; Edit ED_REPL { BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 25 ) ; - Size = MAP_APPFONT ( 96 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 184 ) ; + Size = MAP_APPFONT ( 225 , 12 ) ; LEFT = TRUE ; }; FixedLine FL_VAR { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 207 , 8 ) ; - Text [ en-US ] = "Variations" ; + Pos = MAP_APPFONT ( 0 , 200 ) ; + Size = MAP_APPFONT ( 235 , 8 ) ; }; - String STR_ERR_WORDNOTFOUND + + HelpButton BTN_THES_HELP { - Text [ en-US ] = "Word not found in thesaurus" ; + Pos = MAP_APPFONT ( 5 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; -}; - // RID_SVXDLG_THES_LANGUAGE ---------------------------------------------- -ModalDialog RID_SVXDLG_THES_LANGUAGE -{ - HelpId = HID_THES_LANGUAGE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 170 , 86 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswählen : Sprache auswõhlen */ - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswählen : Sprache auswõhlen */ - Text [ en-US ] = "Select Language" ; - Moveable = TRUE ; - ListBox LB_THES_LANGUAGE + OkButton BTN_THES_OK { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 90 , 60 ) ; - Sort = TRUE ; + Pos = MAP_APPFONT ( 105 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Replace" ; + DefButton = TRUE ; }; - FixedLine FL_THES_LANGUAGE + CancelButton BTN_THES_CANCEL { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 102 , 8 ) ; - Text [ en-US ] = "Selection" ; + Pos = MAP_APPFONT ( 170 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; - OKButton BTN_LANG_OK + + String STR_ERR_TEXTNOTFOUND { - Pos = MAP_APPFONT ( 114 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; + Text [ en-US ] = "No alternatives found." ; }; - CancelButton BTN_LANG_CANCEL + + Image IMG_DEFAULT_VENDOR { - Pos = MAP_APPFONT ( 114 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + ImageBitmap = Bitmap { File = "vendor01.png"; }; }; - HelpButton BTN_LANG_HELP + Image IMG_DEFAULT_VENDOR_HC { - Pos = MAP_APPFONT ( 114 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + ImageBitmap = Bitmap { File = "vendor01h.png"; }; }; }; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx new file mode 100755 index 000000000000..70ce91391456 --- /dev/null +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_THESDLG_IMPL_HXX +#define _SVX_THESDLG_IMPL_HXX + +#include "thesdlg.hxx" + +#include <svtools/ehdl.hxx> +#include <svx/checklbx.hxx> +#include <vcl/button.hxx> +#include <vcl/combobox.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/image.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/timer.hxx> +#include <vcl/wrkwin.hxx> + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> + +#include <stack> +#include <algorithm> + +using namespace ::com::sun::star; +using ::rtl::OUString; + +// class LookUpComboBox_Impl -------------------------------------------------- + +class LookUpComboBox_Impl : public ComboBox +{ + Timer m_aModifyTimer; + Selection m_aSelection; + Button * m_pBtn; + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + LookUpComboBox_Impl( const LookUpComboBox_Impl & ); + LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & ); + +public: + LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ); + virtual ~LookUpComboBox_Impl(); + + DECL_LINK( ModifyTimer_Hdl, Timer * ); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // ComboBox + virtual void Modify(); +}; + +// class ReplaceEdit_Impl -------------------------------------------------- + +class ReplaceEdit_Impl : public Edit +{ + Button * m_pBtn; + + // disable copy c-tor and assignment operator + ReplaceEdit_Impl( const ReplaceEdit_Impl & ); + ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & ); + +public: + ReplaceEdit_Impl( Window *pParent, const ResId &rResId ); + virtual ~ReplaceEdit_Impl(); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // Edit + virtual void Modify(); + virtual void SetText( const XubString& rStr ); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); +}; + +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- + +class AlternativesUserData_Impl +{ + String sText; + bool bHeader; + + // disable copy c-tor and assignment operator + AlternativesUserData_Impl( const AlternativesUserData_Impl & ); + AlternativesUserData_Impl & operator = ( const AlternativesUserData_Impl & ); + +public: + AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : + sText(rText), + bHeader(bIsHeader) + { + } + + bool IsHeader() const { return bHeader; } + const String& GetText() const { return sText; } +}; + + +class AlternativesString_Impl : public SvLBoxString +{ +public: + + AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) + : SvLBoxString( pEntry, nFlags, rStr ) {} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); +}; + + +class ThesaurusAlternativesCtrl_Impl : + public SvxCheckListBox +{ + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); + ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); + +public: + ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ); + virtual ~ThesaurusAlternativesCtrl_Impl(); + + + SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); + void ClearUserData(); + + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); +}; + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +struct SvxThesaurusDialog_Impl +{ + SvxThesaurusDialog * m_pDialog; + + FixedImage aVendorImageFI; + ImageButton aLeftBtn; + FixedText aWordText; + LookUpComboBox_Impl aWordCB; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + ReplaceEdit_Impl aReplaceEdit; + FixedLine aFL; + HelpButton aHelpBtn; + MenuButton aLangMBtn; + OKButton aReplaceBtn; + CancelButton aCancelBtn; + + String aErrStr; + Image aVendorDefaultImage; + Image aVendorDefaultImageHC; + + uno::Reference< linguistic2::XThesaurus > xThesaurus; + OUString aLookUpText; + LanguageType nLookUpLanguage; + std::stack< OUString > aLookUpHistory; + bool m_bWordFound; + + + // Handler + DECL_LINK( LeftBtnHdl_Impl, Button * ); + DECL_LINK( LanguageHdl_Impl, MenuButton * ); + DECL_LINK( LookUpHdl_Impl, Button * ); + DECL_LINK( WordSelectHdl_Impl, ComboBox * ); + DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); + DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); + + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); + + + SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ); + ~SvxThesaurusDialog_Impl(); + + uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL + queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); + + bool UpdateAlternativesBox_Impl(); + void UpdateVendorImage(); + void LookUp( const String &rText ); + void LookUp_Impl(); +}; + +#endif + diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc index 1d98daa179e1..c4a50ec1bf62 100644..100755 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -373,14 +373,15 @@ #define HID_THES_LANGUAGE (HID_CUI_START + 338) #define HID_OFAPAGE_QUOTE_SW_CLB (HID_CUI_START + 339) #define HID_OFAPAGE_QUOTE_CLB (HID_CUI_START + 340) +#define HID_CT_THES_ALTERNATIVES (HID_CUI_START + 341) -// please adjust ACT_SVX_HID_END2 below if you add entries here! +// please adjust ACT_CUI_HID_END below if you add entries here! // ----------------------------------------------------------------------- // Overrun check --------------------------------------------------------- // ----------------------------------------------------------------------- -#define ACT_CUI_HID_END HID_CUI_START + 340 +#define ACT_CUI_HID_END HID_CUI_START + 341 #if ACT_CUI_HID_END > HID_CUI_END #error Resource-Ueberlauf in #line, #file diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx index 42ec38e31331..502b212c8a91 100644..100755 --- a/cui/source/inc/hyphen.hxx +++ b/cui/source/inc/hyphen.hxx @@ -29,6 +29,8 @@ // include --------------------------------------------------------------- +#include <memory> + #include <vcl/edit.hxx> #include <vcl/button.hxx> #include <vcl/fixed.hxx> @@ -45,73 +47,24 @@ namespace linguistic2{ class SvxSpellWrapper; -// class SvxHyphenEdit --------------------------------------------------- - -class SvxHyphenEdit : public Edit -{ -public: - SvxHyphenEdit( Window* pParent, const ResId& rResId ); - -protected: - virtual void KeyInput( const KeyEvent &rKEvt ); -}; - // class SvxHyphenWordDialog --------------------------------------------- +struct SvxHyphenWordDialog_Impl; + class SvxHyphenWordDialog : public SfxModalDialog { + std::auto_ptr< SvxHyphenWordDialog_Impl > m_pImpl; + public: SvxHyphenWordDialog( const String &rWord, LanguageType nLang, Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > &xHyphen, + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, SvxSpellWrapper* pWrapper ); + virtual ~SvxHyphenWordDialog(); + void SetWindowTitle( LanguageType nLang ); void SelLeft(); void SelRight(); - -private: - FixedText aWordFT; - SvxHyphenEdit aWordEdit; - ImageButton aLeftBtn; - ImageButton aRightBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aContBtn; - PushButton aDelBtn; - HelpButton aHelpBtn; - String aLabel; - SvxSpellWrapper* pHyphWrapper; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > xHyphenator; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > xPossHyph; - String aActWord; // actual (to be displayed) word - LanguageType nActLanguage; // and language - sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos - sal_uInt16 nHyphPos; - sal_uInt16 nOldPos; - sal_Bool bBusy; - - void EnableLRBtn_Impl(); - void SetLabel_Impl( LanguageType nLang ); - String EraseUnusableHyphens_Impl( - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, - sal_uInt16 nMaxHyphenationPos ); - - void InitControls_Impl(); - void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); - sal_uInt16 GetHyphIndex_Impl(); - - DECL_LINK( CutHdl_Impl, Button* ); - DECL_LINK( DeleteHdl_Impl, Button* ); - DECL_LINK( ContinueHdl_Impl, Button* ); - DECL_LINK( CancelHdl_Impl, Button* ); - DECL_LINK( Left_Impl, Button* ); - DECL_LINK( Right_Impl, Button* ); - DECL_LINK( GetFocusHdl_Impl, Edit* ); - DECL_LINK( LangError_Impl, void* ); }; diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx index d46c2ce5affa..99b292b560a5 100644..100755 --- a/cui/source/inc/thesdlg.hxx +++ b/cui/source/inc/thesdlg.hxx @@ -27,94 +27,34 @@ #ifndef _SVX_THESDLG_HXX #define _SVX_THESDLG_HXX -// include --------------------------------------------------------------- -#include <vcl/edit.hxx> -#include <vcl/button.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/fixed.hxx> -#include <svx/stddlg.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/linguistic2/XThesaurus.hpp> -// forward --------------------------------------------------------------- +#include "svx/stddlg.hxx" +#include "svx/svxdllapi.h" -struct ThesDlg_Impl; +#include <memory> -class SvxThesaurusLanguageDlg_Impl; -namespace com { namespace sun { namespace star { - namespace linguistic2 { - class XThesaurus; - class XMeaning; - } - namespace lang { - struct Locale; - } -}}} +///////////////////////////////////////////////////////////////// -// class SvxThesaurusDialog ---------------------------------------------- +struct SvxThesaurusDialog_Impl; class SvxThesaurusDialog : public SvxStandardDialog { -public: - friend class SvxThesaurusLanguageDlg_Impl; + std::auto_ptr< SvxThesaurusDialog_Impl > m_pImpl; + + SVX_DLLPRIVATE virtual void Apply(); +public: SvxThesaurusDialog( Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ); + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, + const String &rWord, LanguageType nLanguage ); ~SvxThesaurusDialog(); - String GetWord() { return aReplaceEdit.GetText(); } - + void SetWindowTitle( LanguageType nLanguage ); + String GetWord(); sal_uInt16 GetLanguage() const; - -private: - FixedText aWordText; - ListBox aWordLB; - FixedText aReplaceText; - Edit aReplaceEdit; - FixedText aMeanText; - ListBox aMeanLB; - FixedText aSynonymText; - ListBox aSynonymLB; - FixedLine aVarFL; - - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aLookUpBtn; - PushButton aLangBtn; - HelpButton aHelpBtn; - - String aErrStr; - - ThesDlg_Impl* pImpl; // always != NULL - - virtual void Apply(); - - void UpdateSynonymBox_Impl(); - void UpdateMeaningBox_Impl( - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XMeaning > > *pMeaningSeq = NULL ); - void Init_Impl(sal_Int16 nLanguage); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XMeaning > > - SAL_CALL queryMeanings_Impl( - ::rtl::OUString& rTerm, - const ::com::sun::star::lang::Locale& rLocale, - const ::com::sun::star::beans::PropertyValues& rProperties ) - throw(::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - // Handler - DECL_LINK( SelectHdl_Impl, ListBox * ); - DECL_LINK( SynonymHdl_Impl, ListBox * ); - DECL_LINK( LookUpHdl_Impl, Button * ); - DECL_LINK( LanguageHdl_Impl, Button * ); - DECL_LINK( EntryHdl_Impl, ListBox * ); - DECL_LINK( SpellErrorHdl_Impl, void * ); }; #endif diff --git a/default_images/res/commandimagelist/lc_downsearch.png b/default_images/res/commandimagelist/lc_downsearch.png Binary files differnew file mode 100644 index 000000000000..e93b54c3fcc6 --- /dev/null +++ b/default_images/res/commandimagelist/lc_downsearch.png diff --git a/default_images/res/commandimagelist/lc_upsearch.png b/default_images/res/commandimagelist/lc_upsearch.png Binary files differnew file mode 100644 index 000000000000..8a0cbce6ffb7 --- /dev/null +++ b/default_images/res/commandimagelist/lc_upsearch.png diff --git a/default_images/res/commandimagelist/lch_downsearch.png b/default_images/res/commandimagelist/lch_downsearch.png Binary files differnew file mode 100644 index 000000000000..5f66ba3ea45e --- /dev/null +++ b/default_images/res/commandimagelist/lch_downsearch.png diff --git a/default_images/res/commandimagelist/lch_upsearch.png b/default_images/res/commandimagelist/lch_upsearch.png Binary files differnew file mode 100644 index 000000000000..1686ff2b7f98 --- /dev/null +++ b/default_images/res/commandimagelist/lch_upsearch.png diff --git a/default_images/res/commandimagelist/sc_downsearch.png b/default_images/res/commandimagelist/sc_downsearch.png Binary files differnew file mode 100644 index 000000000000..095242d902de --- /dev/null +++ b/default_images/res/commandimagelist/sc_downsearch.png diff --git a/default_images/res/commandimagelist/sc_upsearch.png b/default_images/res/commandimagelist/sc_upsearch.png Binary files differnew file mode 100644 index 000000000000..9921bb8409d4 --- /dev/null +++ b/default_images/res/commandimagelist/sc_upsearch.png diff --git a/default_images/res/commandimagelist/sch_downsearch.png b/default_images/res/commandimagelist/sch_downsearch.png Binary files differnew file mode 100644 index 000000000000..943e897f8b1f --- /dev/null +++ b/default_images/res/commandimagelist/sch_downsearch.png diff --git a/default_images/res/commandimagelist/sch_upsearch.png b/default_images/res/commandimagelist/sch_upsearch.png Binary files differnew file mode 100644 index 000000000000..a29aff5ac060 --- /dev/null +++ b/default_images/res/commandimagelist/sch_upsearch.png diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk index 6a9c7b6bbb38..52092a077a4b 100644 --- a/desktop/source/deployment/gui/makefile.mk +++ b/desktop/source/deployment/gui/makefile.mk @@ -77,6 +77,7 @@ SHL1STDLIBS = \ $(SVTOOLLIB) \ $(SVLLIB) \ $(SVXLIB) \ + $(SVXCORELIB) \ $(SFXLIB) \ $(DEPLOYMENTMISCLIB) \ $(OLE32LIB) diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx index 4a144f3fdf20..ac28b6816708 100644 --- a/desktop/source/deployment/misc/dp_platform.cxx +++ b/desktop/source/deployment/misc/dp_platform.cxx @@ -39,6 +39,8 @@ #define PLATFORM_WIN_X86 "windows_x86" #define PLATFORM_LINUX_X86 "linux_x86" #define PLATFORM_LINUX_X86_64 "linux_x86_64" +#define PLATFORM_KFREEBSD_X86 "kfreebsd_x86" +#define PLATFORM_KFREEBSD_X86_64 "kfreebsd_x86_64" #define PLATFORM_LINUX_SPARC "linux_sparc" #define PLATFORM_LINUX_POWERPC "linux_powerpc" #define PLATFORM_LINUX_POWERPC64 "linux_powerpc64" @@ -129,6 +131,10 @@ namespace ret = checkOSandCPU(OUSTR("Linux"), OUSTR("x86")); else if (token.equals(OUSTR(PLATFORM_LINUX_X86_64))) ret = checkOSandCPU(OUSTR("Linux"), OUSTR("X86_64")); + else if (token.equals(OUSTR(PLATFORM_KFREEBSD_X86))) + ret = checkOSandCPU(OUSTR("kFreeBSD"), OUSTR("x86")); + else if (token.equals(OUSTR(PLATFORM_KFREEBSD_X86_64))) + ret = checkOSandCPU(OUSTR("kFreeBSD"), OUSTR("X86_64")); else if (token.equals(OUSTR(PLATFORM_LINUX_SPARC))) ret = checkOSandCPU(OUSTR("Linux"), OUSTR("SPARC")); else if (token.equals(OUSTR(PLATFORM_LINUX_POWERPC))) diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 3789171ce254..c219a839b99a 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -59,6 +59,11 @@ #include <com/sun/star/util/XRefreshable.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/ui/XUIConfigurationStorage.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> using namespace rtl; using namespace osl; @@ -73,6 +78,120 @@ using namespace com::sun::star; namespace desktop { +static const ::rtl::OUString ITEM_DESCRIPTOR_COMMANDURL = ::rtl::OUString::createFromAscii("CommandURL"); +static const ::rtl::OUString ITEM_DESCRIPTOR_CONTAINER = ::rtl::OUString::createFromAscii("ItemDescriptorContainer"); +static const ::rtl::OUString ITEM_DESCRIPTOR_LABEL = ::rtl::OUString::createFromAscii("Label"); + +static const ::rtl::OUString MENU_SEPERATOR = ::rtl::OUString::createFromAscii(" | "); +static const ::rtl::OUString MENU_SUBMENU = ::rtl::OUString::createFromAscii("..."); + +::rtl::OUString retrieveLabelFromCommand(const ::rtl::OUString& sCommand, const ::rtl::OUString& sModuleIdentifier) +{ + ::rtl::OUString sLabel; + + uno::Reference< container::XNameAccess > xUICommands; + uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); + if ( xNameAccess.is() ) + { + uno::Any a = xNameAccess->getByName( sModuleIdentifier ); + a >>= xUICommands; + } + if (xUICommands.is()) + { + if ( sCommand.getLength() > 0 ) + { + rtl::OUString aStr; + ::uno::Sequence< beans::PropertyValue > aPropSeq; + try + { + uno::Any a( xUICommands->getByName( sCommand )); + if ( a >>= aPropSeq ) + { + for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) + { + if ( aPropSeq[i].Name.equalsAscii( "Label" )) + { + aPropSeq[i].Value >>= aStr; + break; + } + } + } + + sLabel = aStr; + } + + catch(container::NoSuchElementException&) + { + sLabel = sCommand; + sal_Int32 nIndex = sLabel.indexOf(':'); + if (nIndex>=0 && nIndex <= sLabel.getLength()-1) + sLabel = sLabel.copy(nIndex+1); + } + + } + } + + return sLabel; +} + +::rtl::OUString stripHotKey( const ::rtl::OUString& str ) +{ + sal_Int32 index = str.indexOf( '~' ); + if ( index == -1 ) + { + return str; + } + else + { + return str.replaceAt( index, 1, ::rtl::OUString() ); + } +} + +::rtl::OUString mapModuleShortNameToIdentifier(const ::rtl::OUString& sShortName) +{ + ::rtl::OUString sIdentifier; + + if (sShortName.equals(::rtl::OUString::createFromAscii("StartModule"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.frame.StartModule"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("swriter"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.text.TextDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("scalc"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("sdraw"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.drawing.DrawingDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("simpress"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.presentation.PresentationDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("smath"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.formula.FormulaProperties"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("schart"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("BasicIDE"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.script.BasicIDE"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("dbapp"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.sdb.OfficeDatabaseDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("sglobal"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.text.GlobalDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("sweb"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.text.WebDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("swxform"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.xforms.XMLFormDocument"); + + else if (sShortName.equals(::rtl::OUString::createFromAscii("sbibliography"))) + sIdentifier = ::rtl::OUString::createFromAscii("com.sun.star.frame.Bibliography"); + + return sIdentifier; +} static MigrationImpl *pImpl = 0; static Mutex aMutex; @@ -160,9 +279,72 @@ sal_Bool MigrationImpl::doMigration() m_vrFileList = compileFileList(); sal_Bool result = sal_False; - try{ + try + { + NewVersionUIInfo aNewVersionUIInfo; + ::std::vector< MigrationModuleInfo > vModulesInfo = dectectUIChangesForAllModules(); + aNewVersionUIInfo.init(vModulesInfo); + copyFiles(); + const ::rtl::OUString sMenubarResourceURL = ::rtl::OUString::createFromAscii("private:resource/menubar/menubar"); + const ::rtl::OUString sToolbarResourcePre = ::rtl::OUString::createFromAscii("private:resource/toolbar/"); + for (sal_uInt32 i=0; i<vModulesInfo.size(); ++i) + { + ::rtl::OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName); + if (sModuleIdentifier.getLength()==0) + continue; + + uno::Sequence< uno::Any > lArgs(2); + ::rtl::OUString aOldCfgDataPath = m_aInfo.userdata + ::rtl::OUString::createFromAscii("/user/config/soffice.cfg/modules/"); + lArgs[0] <<= aOldCfgDataPath + vModulesInfo[i].sModuleShortName; + lArgs[1] <<= embed::ElementModes::READ; + + uno::Reference< lang::XSingleServiceFactory > xStorageFactory(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.embed.FileSystemStorageFactory")), uno::UNO_QUERY); + uno::Reference< embed::XStorage > xModules; + + xModules = uno::Reference< embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); + uno::Reference< ui::XUIConfigurationManager > xOldCfgManager( m_xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.ui.UIConfigurationManager")), uno::UNO_QUERY ); + uno::Reference< ui::XUIConfigurationStorage > xOldCfgStorage( xOldCfgManager, uno::UNO_QUERY ); + uno::Reference< ui::XUIConfigurationPersistence > xOldCfgPersistence( xOldCfgManager, uno::UNO_QUERY ); + + if ( xOldCfgStorage.is() && xOldCfgPersistence.is() && xModules.is() ) + { + xOldCfgStorage->setStorage( xModules ); + xOldCfgPersistence->reload(); + } + + uno::Reference< ui::XUIConfigurationManager > xCfgManager = aNewVersionUIInfo.getConfigManager(vModulesInfo[i].sModuleShortName); + + if (vModulesInfo[i].bHasMenubar) + { + uno::Reference< container::XIndexContainer > xOldVersionMenuSettings = uno::Reference< container::XIndexContainer >(xOldCfgManager->getSettings(sMenubarResourceURL, sal_True), uno::UNO_QUERY); + uno::Reference< container::XIndexContainer > xNewVersionMenuSettings = aNewVersionUIInfo.getNewMenubarSettings(vModulesInfo[i].sModuleShortName); + ::rtl::OUString sParent; + compareOldAndNewConfig(sParent, xOldVersionMenuSettings, xNewVersionMenuSettings, sMenubarResourceURL); + mergeOldToNewVersion(xCfgManager, xNewVersionMenuSettings, sModuleIdentifier, sMenubarResourceURL); + } + + sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size(); + if (nToolbars >0) + { + for (sal_Int32 j=0; j<nToolbars; ++j) + { + ::rtl::OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; + ::rtl::OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; + + uno::Reference< container::XIndexContainer > xOldVersionToolbarSettings = uno::Reference< container::XIndexContainer >(xOldCfgManager->getSettings(sToolbarResourceURL, sal_True), uno::UNO_QUERY); + uno::Reference< container::XIndexContainer > xNewVersionToolbarSettings = aNewVersionUIInfo.getNewToolbarSettings(vModulesInfo[i].sModuleShortName, sToolbarName); + ::rtl::OUString sParent; + compareOldAndNewConfig(sParent, xOldVersionToolbarSettings, xNewVersionToolbarSettings, sToolbarResourceURL); + mergeOldToNewVersion(xCfgManager, xNewVersionToolbarSettings, sModuleIdentifier, sToolbarResourceURL); + } + } + + m_aOldVersionItemsHashMap.clear(); + m_aNewVersionItemsHashMap.clear(); + } + // execute the migration items from Setup.xcu copyConfig(); @@ -291,10 +473,14 @@ migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigratio tmpStep.name = seqMigrations[i]; // read included files from current step description + ::rtl::OUString aSeqEntry; if (tmpAccess->getByName(OUString::createFromAscii("IncludedFiles")) >>= tmpSeq) { for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - tmpStep.includeFiles.push_back(tmpSeq[j]); + { + aSeqEntry = tmpSeq[j]; + tmpStep.includeFiles.push_back(aSeqEntry); + } } // exluded files... @@ -329,7 +515,10 @@ migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigratio if (tmpAccess->getByName(OUString::createFromAscii("ExcludedExtensions")) >>= tmpSeq) { for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - tmpStep.excludeExtensions.push_back(tmpSeq[j]); + { + aSeqEntry = tmpSeq[j]; + tmpStep.excludeExtensions.push_back(aSeqEntry); + } } // generic service @@ -781,4 +970,396 @@ void MigrationImpl::runServices() } } +::std::vector< MigrationModuleInfo > MigrationImpl::dectectUIChangesForAllModules() const +{ + ::std::vector< MigrationModuleInfo > vModulesInfo; + const ::rtl::OUString MENUBAR = ::rtl::OUString::createFromAscii("menubar"); + const ::rtl::OUString TOOLBAR = ::rtl::OUString::createFromAscii("toolbar"); + + uno::Sequence< uno::Any > lArgs(2); + lArgs[0] <<= m_aInfo.userdata + ::rtl::OUString::createFromAscii("/user/config/soffice.cfg/modules"); + lArgs[1] <<= embed::ElementModes::READ; + + uno::Reference< lang::XSingleServiceFactory > xStorageFactory(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.embed.FileSystemStorageFactory")), uno::UNO_QUERY); + uno::Reference< embed::XStorage > xModules; + + xModules = uno::Reference< embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); + if (!xModules.is()) + return vModulesInfo; + + uno::Reference< container::XNameAccess > xAccess = uno::Reference< container::XNameAccess >(xModules, uno::UNO_QUERY); + uno::Sequence< ::rtl::OUString > lNames = xAccess->getElementNames(); + sal_Int32 nLength = lNames.getLength(); + for (sal_Int32 i=0; i<nLength; ++i) + { + ::rtl::OUString sModuleShortName = lNames[i]; + uno::Reference< embed::XStorage > xModule = xModules->openStorageElement(sModuleShortName, embed::ElementModes::READ); + if (xModule.is()) + { + MigrationModuleInfo aModuleInfo; + + uno::Reference< embed::XStorage > xMenubar = xModule->openStorageElement(MENUBAR, embed::ElementModes::READ); + if (xMenubar.is()) + { + uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xMenubar, uno::UNO_QUERY); + if (xNameAccess->getElementNames().getLength() > 0) + { + aModuleInfo.sModuleShortName = sModuleShortName; + aModuleInfo.bHasMenubar = sal_True; + } + } + + uno::Reference< embed::XStorage > xToolbar = xModule->openStorageElement(TOOLBAR, embed::ElementModes::READ); + if (xToolbar.is()) + { + const ::rtl::OUString RESOURCEURL_CUSTOM_ELEMENT = ::rtl::OUString::createFromAscii("custom_"); + sal_Int32 nCustomLen = 7; + + uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xToolbar, uno::UNO_QUERY); + ::uno::Sequence< ::rtl::OUString > lToolbars = xNameAccess->getElementNames(); + for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) + { + ::rtl::OUString sToolbarName = lToolbars[j]; + if (sToolbarName.getLength()>=nCustomLen && + sToolbarName.copy(0, nCustomLen).equals(RESOURCEURL_CUSTOM_ELEMENT)) + continue; + + aModuleInfo.sModuleShortName = sModuleShortName; + sal_Int32 nIndex = sToolbarName.lastIndexOf('.'); + if (nIndex > 0) + { + ::rtl::OUString sExtension(sToolbarName.copy(nIndex)); + ::rtl::OUString sToolbarResourceName(sToolbarName.copy(0, nIndex)); + if (sToolbarResourceName.getLength()>0 && sExtension.equalsAsciiL(".xml", 4)) + aModuleInfo.m_vToolbars.push_back(sToolbarResourceName); + } + } + } + + if (aModuleInfo.sModuleShortName.getLength()>0) + vModulesInfo.push_back(aModuleInfo); + } + } + + return vModulesInfo; +} + +void MigrationImpl::compareOldAndNewConfig(const ::rtl::OUString& sParent, + const uno::Reference< container::XIndexContainer >& xIndexOld, + const uno::Reference< container::XIndexContainer >& xIndexNew, + const ::rtl::OUString& sResourceURL) +{ + ::std::vector< MigrationItem > vOldItems; + ::std::vector< MigrationItem > vNewItems; + uno::Sequence< beans::PropertyValue > aProp; + sal_Int32 nOldCount = xIndexOld->getCount(); + sal_Int32 nNewCount = xIndexNew->getCount(); + + for (int n=0; n<nOldCount; ++n) + { + MigrationItem aMigrationItem; + if (xIndexOld->getByIndex(n) >>= aProp) + { + for(int i=0; i<aProp.getLength(); ++i) + { + if (aProp[i].Name.equals(ITEM_DESCRIPTOR_COMMANDURL)) + aProp[i].Value >>= aMigrationItem.m_sCommandURL; + else if (aProp[i].Name.equals(ITEM_DESCRIPTOR_CONTAINER)) + aProp[i].Value >>= aMigrationItem.m_xPopupMenu; + } + + if (aMigrationItem.m_sCommandURL.getLength()) + vOldItems.push_back(aMigrationItem); + } + } + + for (int n=0; n<nNewCount; ++n) + { + MigrationItem aMigrationItem; + if (xIndexNew->getByIndex(n) >>= aProp) + { + for(int i=0; i<aProp.getLength(); ++i) + { + if (aProp[i].Name.equals(ITEM_DESCRIPTOR_COMMANDURL)) + aProp[i].Value >>= aMigrationItem.m_sCommandURL; + else if (aProp[i].Name.equals(ITEM_DESCRIPTOR_CONTAINER)) + aProp[i].Value >>= aMigrationItem.m_xPopupMenu; + } + + if (aMigrationItem.m_sCommandURL.getLength()) + vNewItems.push_back(aMigrationItem); + } + } + + ::std::vector< MigrationItem >::iterator it; + + ::rtl::OUString sSibling; + for (it = vOldItems.begin(); it!=vOldItems.end(); ++it) + { + ::std::vector< MigrationItem >::iterator pFound = ::std::find(vNewItems.begin(), vNewItems.end(), *it); + if (pFound != vNewItems.end() && it->m_xPopupMenu.is()) + { + ::rtl::OUString sName; + if (sParent.getLength()>0) + sName = sParent + MENU_SEPERATOR + it->m_sCommandURL; + else + sName = it->m_sCommandURL; + compareOldAndNewConfig(sName, it->m_xPopupMenu, pFound->m_xPopupMenu, sResourceURL); + } + else if (pFound == vNewItems.end()) + { + MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); + if (m_aOldVersionItemsHashMap.find(sResourceURL)==m_aOldVersionItemsHashMap.end()) + { + ::std::vector< MigrationItem > vMigrationItems; + m_aOldVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); + m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); + } + else + { + if (::std::find(m_aOldVersionItemsHashMap[sResourceURL].begin(), m_aOldVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aOldVersionItemsHashMap[sResourceURL].end()) + m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); + } + } + + sSibling = it->m_sCommandURL; + } + + ::rtl::OUString sNewSibling; + uno::Reference< container::XIndexContainer > xPopup; + for (it = vNewItems.begin(); it!=vNewItems.end(); ++it) + { + ::std::vector< MigrationItem >::iterator pFound = ::std::find(vOldItems.begin(), vOldItems.end(), *it); + if (pFound != vOldItems.end() && it->m_xPopupMenu.is()) + { + ::rtl::OUString sName; + if (sParent.getLength()>0) + sName = sParent + MENU_SEPERATOR + it->m_sCommandURL; + else + sName = it->m_sCommandURL; + compareOldAndNewConfig(sName, pFound->m_xPopupMenu, it->m_xPopupMenu, sResourceURL); + } + else if (::std::find(vOldItems.begin(), vOldItems.end(), *it) == vOldItems.end()) + { + MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); + if (m_aNewVersionItemsHashMap.find(sResourceURL)==m_aNewVersionItemsHashMap.end()) + { + ::std::vector< MigrationItem > vMigrationItems; + m_aNewVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); + m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); + } + else + { + if (::std::find(m_aNewVersionItemsHashMap[sResourceURL].begin(), m_aNewVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aNewVersionItemsHashMap[sResourceURL].end()) + m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); + } + } + } +} + +void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurationManager >& xCfgManager, + const uno::Reference< container::XIndexContainer>& xIndexContainer, + const ::rtl::OUString& sModuleIdentifier, + const ::rtl::OUString& sResourceURL) +{ + MigrationHashMap::iterator pFound = m_aOldVersionItemsHashMap.find(sResourceURL); + if (pFound==m_aOldVersionItemsHashMap.end()) + return; + + ::std::vector< MigrationItem >::iterator it; + for (it=pFound->second.begin(); it!=pFound->second.end(); ++it) + { + uno::Reference< container::XIndexContainer > xTemp = xIndexContainer; + + ::rtl::OUString sParentNodeName = it->m_sParentNodeName; + sal_Int32 nIndex = 0; + do + { + ::rtl::OUString sToken = sParentNodeName.getToken(0, '|', nIndex).trim(); + if (sToken.getLength()<=0) + break; + + sal_Int32 nCount = xTemp->getCount(); + for (sal_Int32 i=0; i<nCount; ++i) + { + ::rtl::OUString sCommandURL; + ::rtl::OUString sLabel; + uno::Reference< container::XIndexContainer > xChild; + + uno::Sequence< beans::PropertyValue > aPropSeq; + xTemp->getByIndex(i) >>= aPropSeq; + for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j) + { + ::rtl::OUString sPropName = aPropSeq[j].Name; + if (sPropName.equals(ITEM_DESCRIPTOR_COMMANDURL)) + aPropSeq[j].Value >>= sCommandURL; + else if (sPropName.equals(ITEM_DESCRIPTOR_LABEL)) + aPropSeq[j].Value >>= sLabel; + else if (sPropName.equals(ITEM_DESCRIPTOR_CONTAINER)) + aPropSeq[j].Value >>= xChild; + } + + if (sCommandURL == sToken) + { + xTemp = xChild; + break; + } + } + + } while (nIndex>=0); + + if (nIndex == -1) + { + uno::Sequence< beans::PropertyValue > aPropSeq(3); + + aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL; + aPropSeq[0].Value <<= it->m_sCommandURL; + aPropSeq[1].Name = ITEM_DESCRIPTOR_LABEL; + aPropSeq[1].Value <<= retrieveLabelFromCommand(it->m_sCommandURL, sModuleIdentifier); + aPropSeq[2].Name = ITEM_DESCRIPTOR_CONTAINER; + aPropSeq[2].Value <<= it->m_xPopupMenu; + + if (it->m_sPrevSibling.getLength() == 0) + xTemp->insertByIndex(0, uno::makeAny(aPropSeq)); + else if (it->m_sPrevSibling.getLength() > 0) + { + sal_Int32 nCount = xTemp->getCount(); + sal_Int32 i = 0; + for (; i<nCount; ++i) + { + ::rtl::OUString sCmd; + uno::Sequence< beans::PropertyValue > aTempPropSeq; + xTemp->getByIndex(i) >>= aTempPropSeq; + for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j) + { + if (aTempPropSeq[j].Name.equals(ITEM_DESCRIPTOR_COMMANDURL)) + { + aTempPropSeq[j].Value >>= sCmd; + break; + } + } + + if (sCmd.equals(it->m_sPrevSibling)) + break; + } + + xTemp->insertByIndex(i+1, uno::makeAny(aPropSeq)); + } + } + } + + uno::Reference< container::XIndexAccess > xIndexAccess(xIndexContainer, uno::UNO_QUERY); + if (xIndexAccess.is()) + xCfgManager->replaceSettings(sResourceURL, xIndexAccess); + + uno::Reference< ui::XUIConfigurationPersistence > xUIConfigurationPersistence(xCfgManager, uno::UNO_QUERY); + if (xUIConfigurationPersistence.is()) + xUIConfigurationPersistence->store(); +} + +uno::Reference< ui::XUIConfigurationManager > NewVersionUIInfo::getConfigManager(const ::rtl::OUString& sModuleShortName) const +{ + uno::Reference< ui::XUIConfigurationManager > xCfgManager; + + for (sal_Int32 i=0; i<m_lCfgManagerSeq.getLength(); ++i) + { + if (m_lCfgManagerSeq[i].Name.equals(sModuleShortName)) + { + m_lCfgManagerSeq[i].Value >>= xCfgManager; + break; + } + } + + return xCfgManager; +} + +uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewMenubarSettings(const ::rtl::OUString& sModuleShortName) const +{ + uno::Reference< container::XIndexContainer > xNewMenuSettings; + + for (sal_Int32 i=0; i<m_lNewVersionMenubarSettingsSeq.getLength(); ++i) + { + if (m_lNewVersionMenubarSettingsSeq[i].Name.equals(sModuleShortName)) + { + m_lNewVersionMenubarSettingsSeq[i].Value >>= xNewMenuSettings; + break; + } + } + + return xNewMenuSettings; +} + +uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewToolbarSettings(const ::rtl::OUString& sModuleShortName, const ::rtl::OUString& sToolbarName) const +{ + uno::Reference< container::XIndexContainer > xNewToolbarSettings; + + for (sal_Int32 i=0; i<m_lNewVersionToolbarSettingsSeq.getLength(); ++i) + { + if (m_lNewVersionToolbarSettingsSeq[i].Name.equals(sModuleShortName)) + { + uno::Sequence< beans::PropertyValue > lToolbarSettingsSeq; + m_lNewVersionToolbarSettingsSeq[i].Value >>= lToolbarSettingsSeq; + for (sal_Int32 j=0; j<lToolbarSettingsSeq.getLength(); ++j) + { + if (lToolbarSettingsSeq[j].Name.equals(sToolbarName)) + { + lToolbarSettingsSeq[j].Value >>= xNewToolbarSettings; + break; + } + } + + break; + } + } + + return xNewToolbarSettings; +} + +void NewVersionUIInfo::init(const ::std::vector< MigrationModuleInfo >& vModulesInfo) +{ + m_lCfgManagerSeq.realloc(vModulesInfo.size()); + m_lNewVersionMenubarSettingsSeq.realloc(vModulesInfo.size()); + m_lNewVersionToolbarSettingsSeq.realloc(vModulesInfo.size()); + + const ::rtl::OUString sModuleCfgSupplier = ::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); + const ::rtl::OUString sMenubarResourceURL = ::rtl::OUString::createFromAscii("private:resource/menubar/menubar"); + const ::rtl::OUString sToolbarResourcePre = ::rtl::OUString::createFromAscii("private:resource/toolbar/"); + + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = uno::Reference< ui::XModuleUIConfigurationManagerSupplier >(::comphelper::getProcessServiceFactory()->createInstance(sModuleCfgSupplier), uno::UNO_QUERY); + + for (sal_uInt32 i=0; i<vModulesInfo.size(); ++i) + { + ::rtl::OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName); + if (sModuleIdentifier.getLength() > 0) + { + uno::Reference< ui::XUIConfigurationManager > xCfgManager = xModuleCfgSupplier->getUIConfigurationManager(sModuleIdentifier); + m_lCfgManagerSeq[i].Name = vModulesInfo[i].sModuleShortName; + m_lCfgManagerSeq[i].Value <<= xCfgManager; + + if (vModulesInfo[i].bHasMenubar) + { + m_lNewVersionMenubarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; + m_lNewVersionMenubarSettingsSeq[i].Value <<= xCfgManager->getSettings(sMenubarResourceURL, sal_True); + } + + sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size(); + if (nToolbars > 0) + { + uno::Sequence< beans::PropertyValue > lPropSeq(nToolbars); + for (sal_Int32 j=0; j<nToolbars; ++j) + { + ::rtl::OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; + ::rtl::OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; + + lPropSeq[j].Name = sToolbarName; + lPropSeq[j].Value <<= xCfgManager->getSettings(sToolbarResourceURL, sal_True); + } + + m_lNewVersionToolbarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; + m_lNewVersionToolbarSettingsSeq[i].Value <<= lPropSeq; + } + } + } +} + } // namespace desktop diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx index 8cad1cce4b16..f73e44fea523 100644 --- a/desktop/source/migration/migration_impl.hxx +++ b/desktop/source/migration/migration_impl.hxx @@ -30,6 +30,7 @@ #include <vector> #include <algorithm> #include <memory> +#include <hash_map> #include "migration.hxx" @@ -41,6 +42,13 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> #define NS_CSS com::sun::star #define NS_UNO com::sun::star::uno @@ -80,6 +88,107 @@ typedef std::vector< migration_step > migrations_v; typedef std::auto_ptr< migrations_v > migrations_vr; typedef std::vector< supported_migration > migrations_available; +//__________________________________________ +/** + define the item, e.g.:menuitem, toolbaritem, to be migrated. we keep the information + of the command URL, the previous sibling node and the parent node of a item +*/ +struct MigrationItem +{ + ::rtl::OUString m_sParentNodeName; + ::rtl::OUString m_sPrevSibling; + ::rtl::OUString m_sCommandURL; + NS_UNO::Reference< NS_CSS::container::XIndexContainer > m_xPopupMenu; + + MigrationItem() + :m_xPopupMenu(0) + { + } + + MigrationItem(const ::rtl::OUString& sParentNodeName, + const ::rtl::OUString& sPrevSibling, + const ::rtl::OUString& sCommandURL, + const NS_UNO::Reference< NS_CSS::container::XIndexContainer > xPopupMenu) + { + m_sParentNodeName = sParentNodeName; + m_sPrevSibling = sPrevSibling; + m_sCommandURL = sCommandURL; + m_xPopupMenu = xPopupMenu; + } + + MigrationItem& operator=(const MigrationItem& aMigrationItem) + { + m_sParentNodeName = aMigrationItem.m_sParentNodeName; + m_sPrevSibling = aMigrationItem.m_sPrevSibling; + m_sCommandURL = aMigrationItem.m_sCommandURL; + m_xPopupMenu = aMigrationItem.m_xPopupMenu; + + return *this; + } + + sal_Bool operator==(const MigrationItem& aMigrationItem) + { + return ( aMigrationItem.m_sParentNodeName == m_sParentNodeName && + aMigrationItem.m_sPrevSibling == m_sPrevSibling && + aMigrationItem.m_sCommandURL == m_sCommandURL && + aMigrationItem.m_xPopupMenu.is() == m_xPopupMenu.is() ); + } + + ::rtl::OUString GetPrevSibling() const { return m_sPrevSibling; } +}; + +typedef ::std::hash_map< ::rtl::OUString, + ::std::vector< MigrationItem >, + ::rtl::OUStringHash, + ::std::equal_to< ::rtl::OUString > > MigrationHashMap; + +struct MigrationItemInfo +{ + ::rtl::OUString m_sResourceURL; + MigrationItem m_aMigrationItem; + + MigrationItemInfo(){} + + MigrationItemInfo(const ::rtl::OUString& sResourceURL, const MigrationItem& aMigratiionItem) + { + m_sResourceURL = sResourceURL; + m_aMigrationItem = aMigratiionItem; + } +}; + +//__________________________________________ +/** + information for the UI elements to be migrated for one module +*/ +struct MigrationModuleInfo +{ + ::rtl::OUString sModuleShortName; + sal_Bool bHasMenubar; + ::std::vector< ::rtl::OUString > m_vToolbars; + + MigrationModuleInfo():bHasMenubar(sal_False){}; +}; + +//__________________________________________ +/** + get the information before copying the ui configuration files of old version to new version +*/ +class NewVersionUIInfo +{ +public: + + NS_UNO::Reference< NS_CSS::ui::XUIConfigurationManager > getConfigManager(const ::rtl::OUString& sModuleShortName) const; + NS_UNO::Reference< NS_CSS::container::XIndexContainer > getNewMenubarSettings(const ::rtl::OUString& sModuleShortName) const; + NS_UNO::Reference< NS_CSS::container::XIndexContainer > getNewToolbarSettings(const ::rtl::OUString& sModuleShortName, const ::rtl::OUString& sToolbarName) const; + void init(const ::std::vector< MigrationModuleInfo >& vModulesInfo); + +private: + + NS_UNO::Sequence< NS_CSS::beans::PropertyValue > m_lCfgManagerSeq; + NS_UNO::Sequence< NS_CSS::beans::PropertyValue > m_lNewVersionMenubarSettingsSeq; + NS_UNO::Sequence< NS_CSS::beans::PropertyValue > m_lNewVersionToolbarSettingsSeq; +}; + class MigrationImpl { @@ -91,6 +200,9 @@ private: migrations_vr m_vrMigrations; // list of all migration specs from config install_info m_aInfo; // info about the version being migrated strings_vr m_vrFileList; // final list of files to be copied + MigrationHashMap m_aOldVersionItemsHashMap; + MigrationHashMap m_aNewVersionItemsHashMap; + ::rtl::OUString m_sModuleIdentifier; // functions to control the migration process bool readAvailableMigrations(migrations_available&); @@ -105,6 +217,16 @@ private: strings_vr applyPatterns(const strings_v& vSet, const strings_v& vPatterns) const; NS_UNO::Reference< NS_CSS::container::XNameAccess > getConfigAccess(const sal_Char* path, sal_Bool rw=sal_False); + ::std::vector< MigrationModuleInfo > dectectUIChangesForAllModules() const; + void compareOldAndNewConfig(const ::rtl::OUString& sParentNodeName, + const NS_UNO::Reference< NS_CSS::container::XIndexContainer >& xOldIndexContainer, + const NS_UNO::Reference< NS_CSS::container::XIndexContainer >& xNewIndexContainer, + const ::rtl::OUString& sToolbarName); + void mergeOldToNewVersion(const NS_UNO::Reference< NS_CSS::ui::XUIConfigurationManager >& xCfgManager, + const NS_UNO::Reference< NS_CSS::container::XIndexContainer>& xIndexContainer, + const ::rtl::OUString& sModuleIdentifier, + const ::rtl::OUString& sResourceURL); + // actual processing function that perform the migration steps void copyFiles(); void copyConfig(); diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx index ccea5d09321e..15052ecc3c0c 100644 --- a/editeng/inc/editeng/editview.hxx +++ b/editeng/inc/editeng/editview.hxx @@ -28,6 +28,8 @@ #ifndef _MyEDITVIEW_HXX #define _MyEDITVIEW_HXX +#include <com/sun/star/i18n/WordType.hpp> + #include <rsc/rscsfx.hxx> #include <i18npool/lang.h> #include <tools/color.hxx> @@ -111,7 +113,7 @@ public: BOOL HasSelection() const; ESelection GetSelection() const; void SetSelection( const ESelection& rNewSel ); - BOOL SelectCurrentWord(); + BOOL SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); void IndentBlock(); void UnindentBlock(); diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx index 2d7afdb8a68c..a4efc98674fc 100644 --- a/editeng/inc/editeng/outliner.hxx +++ b/editeng/inc/editeng/outliner.hxx @@ -389,6 +389,12 @@ public: Selection GetSurroundingTextSelection() const; }; + +// some thesaurus functionality to avoid code duplication in different projects... +bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView ); +void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ); + + //#if 0 // _SOLAR__PRIVATE DECLARE_LIST(ViewList,OutlinerView*) //#else diff --git a/editeng/inc/editeng/splwrap.hxx b/editeng/inc/editeng/splwrap.hxx index 89eb0b53320b..5e46a96adb9f 100644..100755 --- a/editeng/inc/editeng/splwrap.hxx +++ b/editeng/inc/editeng/splwrap.hxx @@ -56,6 +56,7 @@ class EDITENG_DLLPUBLIC SvxSpellWrapper { private: friend class SvxSpellCheckDialog; friend class SvxHyphenWordDialog; + friend class SvxHyphenWordDialog_Impl; Window* pWin; ::com::sun::star::uno::Reference< diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 766023a0038c..de4a2673829e 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1256,13 +1256,13 @@ void EditView::SpellIgnoreWord() pImpEditView->SpellIgnoreOrAddWord( sal_False ); } -sal_Bool EditView::SelectCurrentWord() +sal_Bool EditView::SelectCurrentWord( sal_Int16 nWordType ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); EditSelection aCurSel( pImpEditView->GetEditSelection() ); pImpEditView->DrawSelection(); - aCurSel = PIMPEE->SelectWord( aCurSel.Max() ); + aCurSel = PIMPEE->SelectWord( aCurSel.Max(), nWordType ); pImpEditView->SetEditSelection( aCurSel ); pImpEditView->DrawSelection(); ShowCursor( sal_True, sal_False ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index fa539da6f138..e2a1fabea0ba 100644..100755 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -26,7 +26,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove + #include "precompiled_editeng.hxx" + +#include <com/sun/star/i18n/WordType.hpp> + #include <svl/intitem.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> @@ -34,7 +38,9 @@ #include <editeng/eerdll.hxx> #include <editeng/lrspitem.hxx> #include <editeng/fhgtitem.hxx> + #include <svl/style.hxx> +#include <i18npool/mslangid.hxx> #define _OUTLINER_CXX #include <editeng/outliner.hxx> @@ -59,6 +65,8 @@ #define OL_SCROLL_HOROFFSET 20 /* in % von VisibleSize.Width */ #define OL_SCROLL_VEROFFSET 20 /* in % von VisibleSize.Height */ +using namespace ::com::sun::star; + DBG_NAME(OutlinerView) @@ -972,7 +980,7 @@ void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) // Eigentlich nicht ganz richtig, das evtl. Einrueckungen // korrigiert werden muessen, aber das kommt spaeter durch ein // allgemeingueltiges Import. - // Dann wird im Inserted gleich ermittelt, was fr eine Einrueckebene + // Dann wird im Inserted gleich ermittelt, was f�r eine Einrueckebene // Moegliche Struktur: // pImportInfo mit DestPara, DestPos, nFormat, pParaObj... // Evtl. Problematisch: @@ -1295,7 +1303,7 @@ void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL b -// ===================================================================== +// ===================================================================== // ====================== Einfache Durchreicher ======================= // ====================================================================== @@ -1670,3 +1678,57 @@ Selection OutlinerView::GetSurroundingTextSelection() const DBG_CHKTHIS(OutlinerView,0); return pEditView->GetSurroundingTextSelection(); } + + +// ====================================================================== +// ===== some code for thesaurus sub menu within context menu +// ====================================================================== + +// returns: true if a word for thesaurus look-up was found at the current cursor position. +// The status string will be word + iso language string (e.g. "light#en-US") +bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( + String &rStatusVal, + LanguageType &rLang, + const EditView &rEditView ) +{ + // get text and locale for thesaurus look up + String aText; + EditEngine *pEditEngine = rEditView.GetEditEngine(); + ESelection aTextSel( rEditView.GetSelection() ); + if (!aTextSel.HasRange()) + aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD ); + aText = pEditEngine->GetText( aTextSel ); + aTextSel.Adjust(); + LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ); + String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); + + // set word and locale to look up as status value + String aStatusVal( aText ); + aStatusVal.AppendAscii( "#" ); + aStatusVal += aLangText; + + rStatusVal = aStatusVal; + rLang = nLang; + + return aText.Len() > 0; +} + + +void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ) +{ + // get selection to use + ESelection aCurSel( rEditView.GetSelection() ); + if (!rEditView.HasSelection()) + { + // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord. + // (In the end both functions will call ImpEditEngine::SelectWord) + rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD ); + aCurSel = rEditView.GetSelection(); + } + + // replace word ... + rEditView.InsertText( rSynonmText ); + rEditView.ShowCursor( sal_True, sal_False ); +} + + diff --git a/epm/epm-3.7.patch b/epm/epm-3.7.patch index 116aa28f6690..02835bc3e5ce 100644 --- a/epm/epm-3.7.patch +++ b/epm/epm-3.7.patch @@ -1,811 +1,657 @@ -*** misc/epm-3.7/bsd.c Tue Jan 14 18:05:01 2003 ---- misc/build/epm-3.7/bsd.c Mon Nov 20 14:54:51 2006 -*************** -*** 26,31 **** ---- 26,38 ---- - - #include "epm.h" - -+ void cr2semicolon(char *command) -+ { -+ int len, i; -+ len=strlen(command); -+ for (i=0;i<len;i++) -+ if(*(command+i)=='\n') *(command+i)=';'; -+ } - +diff -urN epm-3.7-old//bsd.c epm-3.7/bsd.c +--- misc/epm-3.7/bsd.c 2003-01-14 17:05:01.000000000 +0000 ++++ misc/build/epm-3.7/bsd.c 2010-04-19 22:52:32.000000000 +0000 +@@ -26,6 +26,13 @@ + + #include "epm.h" + ++void cr2semicolon(char *command) ++{ ++ int len, i; ++ len=strlen(command); ++ for (i=0;i<len;i++) ++ if(*(command+i)=='\n') *(command+i)=';'; ++} + + /* + * 'make_bsd()' - Make a FreeBSD software distribution package. +@@ -149,8 +156,17 @@ + + for (i = dist->num_depends, d = dist->depends; i > 0; i --, d ++) + { ++#ifdef __FreeBSD__ ++ if (d->type == DEPEND_REQUIRES) { ++ if (dist->relnumber) ++ fprintf(fp, "@pkgdep %s-%s-%d-%s", d->product, dist->version, dist->relnumber, platname); ++ else ++ fprintf(fp, "@pkgdep %s-%s-%s", d->product, dist->version, platname); ++ } ++#else + if (d->type == DEPEND_REQUIRES) + fprintf(fp, "@pkgdep %s", d->product); ++#endif + else + #ifdef __FreeBSD__ + /* +@@ -179,9 +195,11 @@ + " by the BSD packager.\n", stderr); + break; + case COMMAND_POST_INSTALL : ++ cr2semicolon(c->command); + fprintf(fp, "@exec %s\n", c->command); + break; + case COMMAND_PRE_REMOVE : ++ cr2semicolon(c->command); + fprintf(fp, "@unexec %s\n", c->command); + break; + case COMMAND_POST_REMOVE : +@@ -199,7 +217,7 @@ + */ + + fprintf(fp, "@exec /bin/mkdir -p %s\n", file->dst); +- fprintf(fp, "@exec /bin/chown %s:%s %s\n", file->user, file->group, ++ fprintf(fp, "@exec /usr/sbin/chown %s:%s %s\n", file->user, file->group, + file->dst); + fprintf(fp, "@exec /bin/chmod %04o %s\n", file->mode, file->dst); + } +@@ -326,12 +344,13 @@ + if (Verbosity) + puts("Building FreeBSD pkg binary distribution..."); + +- if (run_command(NULL, "pkg_create -p / -s %s -c %s -d %s -f %s %s", ++ if (run_command(NULL, "/usr/sbin/pkg_create -p / -s %s -c %s -d %s -f %s %s", + current, commentname, descrname, plistname, name)) + return (1); + +- if (run_command(NULL, "mv %s.tgz %s", name, directory)) +- return (1); ++ if (run_command(NULL, "mv %s.tbz %s", name, directory)) ++ if (run_command(NULL, "mv %s.tgz %s", name, directory)) ++ return (1); + /* - * 'make_bsd()' - Make a FreeBSD software distribution package. -*************** -*** 149,156 **** ---- 156,172 ---- - - for (i = dist->num_depends, d = dist->depends; i > 0; i --, d ++) - { -+ #ifdef __FreeBSD__ -+ if (d->type == DEPEND_REQUIRES) { -+ if (dist->relnumber) -+ fprintf(fp, "@pkgdep %s-%s-%d-%s", d->product, dist->version, dist->relnumber, platname); -+ else -+ fprintf(fp, "@pkgdep %s-%s-%s", d->product, dist->version, platname); -+ } -+ #else - if (d->type == DEPEND_REQUIRES) - fprintf(fp, "@pkgdep %s", d->product); -+ #endif - else - #ifdef __FreeBSD__ - /* -*************** -*** 179,187 **** ---- 195,205 ---- - " by the BSD packager.\n", stderr); - break; - case COMMAND_POST_INSTALL : -+ cr2semicolon(c->command); - fprintf(fp, "@exec %s\n", c->command); - break; - case COMMAND_PRE_REMOVE : -+ cr2semicolon(c->command); - fprintf(fp, "@unexec %s\n", c->command); - break; - case COMMAND_POST_REMOVE : -*************** -*** 199,205 **** - */ - - fprintf(fp, "@exec /bin/mkdir -p %s\n", file->dst); -! fprintf(fp, "@exec /bin/chown %s:%s %s\n", file->user, file->group, - file->dst); - fprintf(fp, "@exec /bin/chmod %04o %s\n", file->mode, file->dst); - } ---- 217,223 ---- - */ - - fprintf(fp, "@exec /bin/mkdir -p %s\n", file->dst); -! fprintf(fp, "@exec /usr/sbin/chown %s:%s %s\n", file->user, file->group, - file->dst); - fprintf(fp, "@exec /bin/chmod %04o %s\n", file->mode, file->dst); - } -*************** -*** 326,337 **** - if (Verbosity) - puts("Building FreeBSD pkg binary distribution..."); - -! if (run_command(NULL, "pkg_create -p / -s %s -c %s -d %s -f %s %s", - current, commentname, descrname, plistname, name)) - return (1); - -! if (run_command(NULL, "mv %s.tgz %s", name, directory)) -! return (1); - - /* - * Remove temporary files... ---- 344,356 ---- - if (Verbosity) - puts("Building FreeBSD pkg binary distribution..."); - -! if (run_command(NULL, "/usr/sbin/pkg_create -p / -s %s -c %s -d %s -f %s %s", - current, commentname, descrname, plistname, name)) - return (1); - -! if (run_command(NULL, "mv %s.tbz %s", name, directory)) -! if (run_command(NULL, "mv %s.tgz %s", name, directory)) -! return (1); - - /* - * Remove temporary files... -*** misc/epm-3.7/configure Thu Jul 24 03:20:54 2003 ---- misc/build/epm-3.7/configure Mon Nov 20 15:01:11 2006 -*************** -*** 1238,1244 **** ---- 1238,1249 ---- - fi - fi; - -+ # Check whether --enable-fltk or --disable-fltk was given. -+ if test "${enable_fltk+set}" = set; then -+ enableval="$enable_fltk" -+ fi; - -+ - # Check whether --with-docdir or --without-docdir was given. - if test "${with_docdir+set}" = set; then - withval="$with_docdir" -*************** -*** 4904,4939 **** - fi - - -! # Extract the first word of "fltk-config", so it can be a program name with args. -! set dummy fltk-config; ac_word=$2 -! echo "$as_me:$LINENO: checking for $ac_word" >&5 -! echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -! if test "${ac_cv_path_FLTKCONFIG+set}" = set; then -! echo $ECHO_N "(cached) $ECHO_C" >&6 -! else -! case $FLTKCONFIG in -! [\\/]* | ?:[\\/]*) -! ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path. -! ;; -! *) -! as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -! for as_dir in $PATH -! do -! IFS=$as_save_IFS -! test -z "$as_dir" && as_dir=. -! for ac_exec_ext in '' $ac_executable_extensions; do -! if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -! ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext" -! echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -! break 2 - fi -! done -! done -! -! ;; -! esac - fi -- FLTKCONFIG=$ac_cv_path_FLTKCONFIG - - if test -n "$FLTKCONFIG"; then - echo "$as_me:$LINENO: result: $FLTKCONFIG" >&5 ---- 4909,4946 ---- - fi - - -! if eval "test x$enable_fltk = xyes"; then -! # Extract the first word of "fltk-config", so it can be a program name with args. -! set dummy fltk-config; ac_word=$2 -! echo "$as_me:$LINENO: checking for $ac_word" >&5 -! echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -! if test "${ac_cv_path_FLTKCONFIG+set}" = set; then -! echo $ECHO_N "(cached) $ECHO_C" >&6 -! else -! case $FLTKCONFIG in -! [\\/]* | ?:[\\/]*) -! ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path. -! ;; -! *) -! as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -! for as_dir in $PATH -! do -! IFS=$as_save_IFS -! test -z "$as_dir" && as_dir=. -! for ac_exec_ext in '' $ac_executable_extensions; do -! if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -! ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext" -! echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -! break 2 -! fi -! done -! done -! -! ;; -! esac - fi -! FLTKCONFIG=$ac_cv_path_FLTKCONFIG - fi - - if test -n "$FLTKCONFIG"; then - echo "$as_me:$LINENO: result: $FLTKCONFIG" >&5 -*************** -*** 4950,4957 **** ---- 4957,4966 ---- - INSTALL_GUIS="" - INSTALL_OSX="" - -+ if eval "test x$enable_fltk = xyes"; then - { echo "$as_me:$LINENO: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&5 - echo "$as_me: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&2;} -+ fi - else - CXXFLAGS="`$FLTKCONFIG --cflags` ${CXXFLAGS}" - GUIS="setup uninst" -*** misc/epm-3.7/deb.c Wed Jan 15 15:29:24 2003 ---- misc/build/epm-3.7/deb.c Mon Nov 20 14:54:51 2006 -*************** -*** 26,31 **** ---- 26,53 ---- - - #include "epm.h" - -+ /* -+ * 'add_size()' - Append Installed-Size tag to DEBIAN/control file -+ */ + * Remove temporary files... +diff -urN epm-3.7-old//configure epm-3.7/configure +--- misc/epm-3.7/configure 2003-07-24 01:20:54.000000000 +0000 ++++ misc/build/epm-3.7/configure 2010-04-19 22:52:32.000000000 +0000 +@@ -1238,6 +1238,11 @@ + fi + fi; + ++# Check whether --enable-fltk or --disable-fltk was given. ++if test "${enable_fltk+set}" = set; then ++ enableval="$enable_fltk" ++fi; ++ + + # Check whether --with-docdir or --without-docdir was given. + if test "${with_docdir+set}" = set; then +@@ -4904,36 +4909,38 @@ + fi + + +-# Extract the first word of "fltk-config", so it can be a program name with args. +-set dummy fltk-config; ac_word=$2 +-echo "$as_me:$LINENO: checking for $ac_word" >&5 +-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +-if test "${ac_cv_path_FLTKCONFIG+set}" = set; then +- echo $ECHO_N "(cached) $ECHO_C" >&6 +-else +- case $FLTKCONFIG in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext" +- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 ++if eval "test x$enable_fltk = xyes"; then ++ # Extract the first word of "fltk-config", so it can be a program name with args. ++ set dummy fltk-config; ac_word=$2 ++ echo "$as_me:$LINENO: checking for $ac_word" >&5 ++ echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++ if test "${ac_cv_path_FLTKCONFIG+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++ else ++ case $FLTKCONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++ for as_dir in $PATH ++ do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++ done ++ done + -+ int /* O - 0 = success, 1 = fail */ -+ add_size(FILE *fpControl, /* Control file stream */ -+ const char *directory) /* Directory containing all files to package */ -+ { -+ FILE *fp; -+ char command[1024]; -+ -+ snprintf(command, sizeof(command), "du -k -s %s", directory); -+ fp = popen(command, "r"); -+ if( NULL != fp ) -+ { -+ char size[1024]; -+ fscanf(fp, "%s .", size); -+ fprintf(fpControl, "Installed-Size: %s\n", size); -+ return pclose(fp); -+ } -+ return 1; -+ } - - /* - * 'make_deb()' - Make a Debian software distribution package. -*************** -*** 61,78 **** - if (Verbosity) - puts("Creating Debian distribution..."); - - if (dist->relnumber) - { - if (platname[0]) -! snprintf(name, sizeof(name), "%s-%s-%d-%s", prodname, dist->version, dist->relnumber, - platname); - else -! snprintf(name, sizeof(name), "%s-%s-%d", prodname, dist->version, dist->relnumber); - } - else if (platname[0]) -! snprintf(name, sizeof(name), "%s-%s-%s", prodname, dist->version, platname); - else -! snprintf(name, sizeof(name), "%s-%s", prodname, dist->version); - - /* - * Write the control file for DPKG... ---- 83,111 ---- - if (Verbosity) - puts("Creating Debian distribution..."); - -+ /* -+ * Use debian default naming scheme -+ */ -+ -+ if (!strcmp(platform->machine, "intel")) -+ platname = "i386"; -+ else if (!strcmp(platform->machine, "x86_64")) -+ platname = "amd64"; -+ else if (!strcmp(platform->machine, "ppc")) -+ platname = "powerpc"; ++ ;; ++ esac + fi +-done +-done +- +- ;; +-esac ++ FLTKCONFIG=$ac_cv_path_FLTKCONFIG + fi +-FLTKCONFIG=$ac_cv_path_FLTKCONFIG + + if test -n "$FLTKCONFIG"; then + echo "$as_me:$LINENO: result: $FLTKCONFIG" >&5 +@@ -4950,8 +4957,10 @@ + INSTALL_GUIS="" + INSTALL_OSX="" + ++if eval "test x$enable_fltk = xyes"; then + { echo "$as_me:$LINENO: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&5 + echo "$as_me: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&2;} ++fi + else + CXXFLAGS="`$FLTKCONFIG --cflags` ${CXXFLAGS}" + GUIS="setup uninst" +diff -urN epm-3.7-old//deb.c epm-3.7/deb.c +--- misc/epm-3.7/deb.c 2003-01-15 14:29:24.000000000 +0000 ++++ misc/build/epm-3.7/deb.c 2010-04-19 22:53:34.000000000 +0000 +@@ -26,6 +26,28 @@ + + #include "epm.h" + ++/* ++ * 'add_size()' - Append Installed-Size tag to DEBIAN/control file ++ */ + - if (dist->relnumber) - { - if (platname[0]) -! snprintf(name, sizeof(name), "%s_%s-%d_%s", prodname, dist->version, dist->relnumber, - platname); - else -! snprintf(name, sizeof(name), "%s_%s-%d", prodname, dist->version, dist->relnumber); - } - else if (platname[0]) -! snprintf(name, sizeof(name), "%s_%s_%s", prodname, dist->version, platname); - else -! snprintf(name, sizeof(name), "%s_%s", prodname, dist->version); - - /* - * Write the control file for DPKG... -*************** -*** 108,115 **** - * (which we change in get_platform to a common name) - */ - -! if (strcmp(platform->machine, "intel") == 0) - fputs("Architecture: i386\n", fp); - else - fprintf(fp, "Architecture: %s\n", platform->machine); - ---- 141,152 ---- - * (which we change in get_platform to a common name) - */ - -! if (!strcmp(platform->machine, "intel")) - fputs("Architecture: i386\n", fp); -+ else if (!strcmp(platform->machine, "x86_64")) -+ fputs("Architecture: amd64\n", fp); -+ else if (!strcmp(platform->machine, "ppc")) -+ fputs("Architecture: powerpc\n", fp); - else - fprintf(fp, "Architecture: %s\n", platform->machine); - -*************** -*** 148,156 **** - putc('\n', fp); - } - } -! - fclose(fp); -! - /* - * Write the preinst file for DPKG... - */ ---- 185,193 ---- - putc('\n', fp); - } - } -! - fclose(fp); -! - /* - * Write the preinst file for DPKG... - */ -*************** -*** 417,422 **** ---- 454,480 ---- - } - } - -+ -+ /* -+ * Calculate and append Installed-Size to DEBIAN/control -+ */ ++int /* O - 0 = success, 1 = fail */ ++add_size(FILE *fpControl, /* Control file stream */ ++ const char *directory) /* Directory containing all files to package */ ++{ ++ FILE *fp; ++ char command[1024]; + -+ if (Verbosity) -+ puts("Calculating Installed-Size..."); ++ snprintf(command, sizeof(command), "du -k -s %s", directory); ++ fp = popen(command, "r"); ++ if( NULL != fp ) ++ { ++ char size[1024]; ++ fscanf(fp, "%s .", size); ++ fprintf(fpControl, "Installed-Size: %s\n", size); ++ return pclose(fp); ++ } ++ return 1; ++} + + /* + * 'make_deb()' - Make a Debian software distribution package. +@@ -61,18 +83,37 @@ + if (Verbosity) + puts("Creating Debian distribution..."); + ++ /* ++ * Use debian default naming scheme ++ */ ++ ++ if (!strcmp(platform->machine, "intel")) ++#ifdef __FreeBSD_kernel__ ++ platname = "kfreebsd-i386"; ++#else ++ platname = "i386"; ++#endif ++ else if (!strcmp(platform->machine, "x86_64")) ++#ifdef __FreeBSD_kernel__ ++ platname = "kfreebsd-amd64"; ++#else ++ platname = "amd64"; ++#endif ++ else if (!strcmp(platform->machine, "ppc")) ++ platname = "powerpc"; ++ + if (dist->relnumber) + { + if (platname[0]) +- snprintf(name, sizeof(name), "%s-%s-%d-%s", prodname, dist->version, dist->relnumber, ++ snprintf(name, sizeof(name), "%s_%s-%d_%s", prodname, dist->version, dist->relnumber, + platname); + else +- snprintf(name, sizeof(name), "%s-%s-%d", prodname, dist->version, dist->relnumber); ++ snprintf(name, sizeof(name), "%s_%s-%d", prodname, dist->version, dist->relnumber); + } + else if (platname[0]) +- snprintf(name, sizeof(name), "%s-%s-%s", prodname, dist->version, platname); ++ snprintf(name, sizeof(name), "%s_%s_%s", prodname, dist->version, platname); + else +- snprintf(name, sizeof(name), "%s-%s", prodname, dist->version); ++ snprintf(name, sizeof(name), "%s_%s", prodname, dist->version); + + /* + * Write the control file for DPKG... +@@ -108,8 +141,20 @@ + * (which we change in get_platform to a common name) + */ + +- if (strcmp(platform->machine, "intel") == 0) ++ if (!strcmp(platform->machine, "intel")) ++#ifdef __FreeBSD_kernel__ ++ fputs("Architecture: kfreebsd-i386\n", fp); ++#else + fputs("Architecture: i386\n", fp); ++#endif ++ else if (!strcmp(platform->machine, "x86_64")) ++#ifdef __FreeBSD_kernel__ ++ fputs("Architecture: kfreebsd-amd64\n", fp); ++#else ++ fputs("Architecture: amd64\n", fp); ++#endif ++ else if (!strcmp(platform->machine, "ppc")) ++ fputs("Architecture: powerpc\n", fp); + else + fprintf(fp, "Architecture: %s\n", platform->machine); + +@@ -148,9 +193,9 @@ + putc('\n', fp); + } + } +- ++ + fclose(fp); +- ++ + /* + * Write the preinst file for DPKG... + */ +@@ -417,6 +462,27 @@ + } + } + ++ ++ /* ++ * Calculate and append Installed-Size to DEBIAN/control ++ */ + -+ snprintf(filename, sizeof(filename), "%s/%s/DEBIAN/control", directory, name); -+ if ((fp = fopen(filename, "a")) == NULL) -+ { -+ fprintf(stderr, "epm: Unable to Installed-Size to file \"%s\" - %s\n", filename, -+ strerror(errno)); -+ return (1); -+ } -+ -+ snprintf(filename, sizeof(filename), "%s/%s", directory, name); -+ add_size(fp, filename); -+ fclose(fp); ++ if (Verbosity) ++ puts("Calculating Installed-Size..."); + ++ snprintf(filename, sizeof(filename), "%s/%s/DEBIAN/control", directory, name); ++ if ((fp = fopen(filename, "a")) == NULL) ++ { ++ fprintf(stderr, "epm: Unable to Installed-Size to file \"%s\" - %s\n", filename, ++ strerror(errno)); ++ return (1); ++ } ++ ++ snprintf(filename, sizeof(filename), "%s/%s", directory, name); ++ add_size(fp, filename); ++ fclose(fp); + - /* - * Build the distribution from the spec file... - */ -*** misc/epm-3.7/dist.c Thu Aug 7 16:14:40 2003 ---- misc/build/epm-3.7/dist.c Mon Nov 20 14:54:51 2006 -*************** -*** 394,401 **** - strcpy(platform->machine, "mips"); - #elif defined(__hpux) - strcpy(platform->machine, "hppa"); -! #elif defined(_AIX) || defined(__APPLE__) - strcpy(platform->machine, "powerpc"); - #else - for (temp = platform->machine; *temp != '\0'; temp ++) - if (*temp == '-' || *temp == '_') ---- 394,406 ---- - strcpy(platform->machine, "mips"); - #elif defined(__hpux) - strcpy(platform->machine, "hppa"); -! #elif defined(_AIX) - strcpy(platform->machine, "powerpc"); -+ #elif defined(__APPLE__) -+ if (strstr(platform->machine, "86") != NULL) -+ strcpy(platform->machine, "intel"); -+ else -+ strcpy(platform->machine, "powerpc"); - #else - for (temp = platform->machine; *temp != '\0'; temp ++) - if (*temp == '-' || *temp == '_') -*************** -*** 407,413 **** - *temp = tolower(*temp); - - if (strstr(platform->machine, "86") != NULL) -! strcpy(platform->machine, "intel"); - else if (strncmp(platform->machine, "sun", 3) == 0) - strcpy(platform->machine, "sparc"); - #endif /* __sgi */ ---- 412,423 ---- - *temp = tolower(*temp); - - if (strstr(platform->machine, "86") != NULL) -! { -! if (strstr(platform->machine, "64") != NULL) -! strcpy(platform->machine, "x86_64"); -! else -! strcpy(platform->machine, "intel"); -! } - else if (strncmp(platform->machine, "sun", 3) == 0) - strcpy(platform->machine, "sparc"); - #endif /* __sgi */ -*** misc/epm-3.7/epm.c Tue Oct 28 15:48:30 2003 ---- misc/build/epm-3.7/epm.c Mon Nov 20 14:54:51 2006 -*************** -*** 547,552 **** ---- 547,553 ---- - { - puts(EPM_VERSION); - puts("Copyright 1999-2003 by Easy Software Products."); -+ puts("Patched for OpenOffice.org"); - puts(""); - puts("EPM is free software and comes with ABSOLUTELY NO WARRANTY; for details"); - puts("see the GNU General Public License in the file COPYING or at"); -*** misc/epm-3.7/file.c Wed Jul 23 23:41:08 2003 ---- misc/build/epm-3.7/file.c Mon Nov 20 14:54:51 2006 -*************** -*** 108,114 **** - fclose(dstfile); - - chmod(dst, mode); -- chown(dst, owner, group); - - return (0); - } ---- 108,113 ---- -*************** -*** 138,144 **** - { - mkdir(buffer, 0777); - chmod(buffer, mode | 0700); -- chown(buffer, owner, group); - } - } - ---- 137,142 ---- -*************** -*** 151,157 **** - { - mkdir(buffer, 0777); - chmod(buffer, mode | 0700); -- chown(buffer, owner, group); - } - - return (0); ---- 149,154 ---- -*** misc/epm-3.7/osx.c Wed Jul 23 23:41:08 2003 ---- misc/build/epm-3.7/osx.c Mon Nov 20 14:54:51 2006 -*************** -*** 373,379 **** - else - snprintf(filename, sizeof(filename), "%s/%s", current, directory); - -! run_command(NULL, "/Developer/Applications/PackageMaker.app/" - "Contents/MacOS/PackageMaker -build " - "-p %s/%s.pkg -f %s/Package -r %s/Resources -d %s/%s-desc.plist -i %s/%s-info.plist", - filename, prodname, filename, filename, filename, prodname, filename, prodname); ---- 373,379 ---- - else - snprintf(filename, sizeof(filename), "%s/%s", current, directory); - -! run_command(NULL, "/Developer/Applications/Utilities/PackageMaker.app/" - "Contents/MacOS/PackageMaker -build " - "-p %s/%s.pkg -f %s/Package -r %s/Resources -d %s/%s-desc.plist -i %s/%s-info.plist", - filename, prodname, filename, filename, filename, prodname, filename, prodname); -*** misc/epm-3.7/pkg.c Tue Dec 17 19:57:56 2002 ---- misc/build/epm-3.7/pkg.c Mon Nov 20 14:54:51 2006 -*************** -*** 429,503 **** - - fclose(fp); - -- /* -- * Build the distribution from the prototype file... -- */ -- -- if (Verbosity) -- puts("Building PKG binary distribution..."); -- -- if (run_command(NULL, "pkgmk -o -f %s/%s.prototype -d %s/%s", -- directory, prodname, current, directory)) -- return (1); -- -- /* -- * Tar and compress the distribution... -- */ -- -- if (Verbosity) -- puts("Creating tar.gz file for distribution..."); -- -- snprintf(filename, sizeof(filename), "%s/%s.tar.gz", directory, name); -- -- if ((tarfile = tar_open(filename, 1)) == NULL) -- return (1); -- -- snprintf(filename, sizeof(filename), "%s/%s", directory, prodname); -- -- if (tar_directory(tarfile, filename, prodname)) -- { -- tar_close(tarfile); -- return (1); -- } -- -- tar_close(tarfile); -- -- /* -- * Make a package stream file... -- */ -- -- if (Verbosity) -- puts("Copying into package stream file..."); -- -- if (run_command(directory, "pkgtrans -s %s/%s %s.pkg %s", -- current, directory, name, prodname)) -- return (1); -- -- /* -- * Remove temporary files... -- */ -- -- if (!KeepFiles) -- { -- if (Verbosity) -- puts("Removing temporary distribution files..."); -- -- snprintf(filename, sizeof(filename), "%s/%s.pkginfo", directory, prodname); -- unlink(filename); -- snprintf(filename, sizeof(filename), "%s/%s.depend", directory, prodname); -- unlink(filename); -- snprintf(filename, sizeof(filename), "%s/%s.prototype", directory, prodname); -- unlink(filename); -- if (preinstall[0]) -- unlink(preinstall); -- if (postinstall[0]) -- unlink(postinstall); -- if (preremove[0]) -- unlink(preremove); -- if (postremove[0]) -- unlink(postremove); -- } -- - return (0); - } - ---- 429,434 ---- -*** misc/epm-3.7/qprintf.c Mon Jan 27 22:48:03 2003 ---- misc/build/epm-3.7/qprintf.c Mon Nov 20 14:54:51 2006 -*************** -*** 181,192 **** - - for (i = slen; i > 0; i --, s ++, bytes ++) - { - if (strchr("`~!#$%^&*()[{]}\\|;\'\"<>? ", *s)) - { - putc('\\', fp); - bytes ++; - } -! - putc(*s, fp); - } - ---- 181,199 ---- - - for (i = slen; i > 0; i --, s ++, bytes ++) - { -+ #if defined(__FreeBSD__) -+ if (strchr("`~!#%^&*()[{]}\\|;\'\"<>? ", *s)) -+ { -+ putc('\\', fp); -+ bytes ++; -+ } -+ #else - if (strchr("`~!#$%^&*()[{]}\\|;\'\"<>? ", *s)) - { - putc('\\', fp); - bytes ++; - } -! #endif - putc(*s, fp); - } - -*** misc/epm-3.7/rpm.c Wed Oct 1 21:27:15 2003 ---- misc/build/epm-3.7/rpm.c Mon Nov 20 14:54:51 2006 -*************** -*** 38,44 **** - dist_t *dist, /* I - Distribution information */ - struct utsname *platform) /* I - Platform information */ - { -! int i; /* Looping var */ - FILE *fp; /* Spec file */ - char name[1024]; /* Full product name */ - char specname[1024]; /* Spec filename */ ---- 38,44 ---- - dist_t *dist, /* I - Distribution information */ - struct utsname *platform) /* I - Platform information */ - { -! int i,n; /* Looping vars */ - FILE *fp; /* Spec file */ - char name[1024]; /* Full product name */ - char specname[1024]; /* Spec filename */ -*************** -*** 160,165 **** ---- 160,167 ---- - fprintf(fp, "Requires: %s", dname); - else if (d->type == DEPEND_PROVIDES) - fprintf(fp, "Provides: %s", dname); -+ else if (d->type == DEPEND_REPLACES) -+ fprintf(fp, "Obsoletes: %s", dname); - else - fprintf(fp, "Conflicts: %s", dname); - -*************** -*** 186,200 **** - for (i = 0; i < dist->num_descriptions; i ++) - fprintf(fp, "%s\n", dist->descriptions[i]); - -! fputs("%pre\n", fp); - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) - if (c->type == COMMAND_PRE_INSTALL) - fprintf(fp, "%s\n", c->command); - -! fputs("%post\n", fp); - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) - if (c->type == COMMAND_POST_INSTALL) - fprintf(fp, "%s\n", c->command); - - for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) - if (tolower(file->type) == 'i') ---- 188,220 ---- - for (i = 0; i < dist->num_descriptions; i ++) - fprintf(fp, "%s\n", dist->descriptions[i]); - -! /* -! * %pre -! */ -! n = 0; - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) -+ { - if (c->type == COMMAND_PRE_INSTALL) -+ { -+ if (1 == ++n) /* Only write %pre if there is at least one command */ -+ fputs("%pre\n", fp); - fprintf(fp, "%s\n", c->command); -+ } -+ } - -! /* -! * %post -! */ -! n = 0; - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) -+ { - if (c->type == COMMAND_POST_INSTALL) -+ { -+ if (1 == ++n) /* Only write %post if there is at least one command */ -+ fputs("%post\n", fp); - fprintf(fp, "%s\n", c->command); -+ } -+ } - - for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) - if (tolower(file->type) == 'i') -*************** -*** 202,207 **** ---- 222,229 ---- - - if (i) - { -+ if (1 == ++n) /* If not previously done so, write %post here */ -+ fputs("%post\n", fp); - fputs("if test \"x$1\" = x1; then\n", fp); - fputs(" echo Setting up init scripts...\n", fp); - -*************** -*** 259,265 **** - fputs("fi\n", fp); - } - -! fputs("%preun\n", fp); - for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) - if (tolower(file->type) == 'i') - break; ---- 281,290 ---- - fputs("fi\n", fp); - } - -! /* -! * %preun -! */ -! n = 0; - for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) - if (tolower(file->type) == 'i') - break; -*************** -*** 266,271 **** ---- 291,297 ---- - - if (i) - { -+ fputs("%preun\n", fp); ++n; /* Need to write %preun here */ - fputs("if test \"x$1\" = x0; then\n", fp); - fputs(" echo Cleaning up init scripts...\n", fp); - -*************** -*** 315,327 **** - } - - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) - if (c->type == COMMAND_PRE_REMOVE) - fprintf(fp, "%s\n", c->command); - -! fputs("%postun\n", fp); - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) - if (c->type == COMMAND_POST_REMOVE) - fprintf(fp, "%s\n", c->command); - - fputs("%files\n", fp); - for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) ---- 341,369 ---- - } - - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) -+ { - if (c->type == COMMAND_PRE_REMOVE) -+ { -+ if (1 == ++n) /* Only write %preun if not previously done so */ -+ fputs("%preun\n", fp); -+ - fprintf(fp, "%s\n", c->command); -+ } -+ } - -! /* -! * %post -! */ -! n = 0; - for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) -+ { - if (c->type == COMMAND_POST_REMOVE) -+ { -+ if (1 == ++n) /* Only write %post if there is at least one command */ -+ fputs("%postun\n", fp); - fprintf(fp, "%s\n", c->command); -+ } -+ } - - fputs("%files\n", fp); - for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) -*************** -*** 415,467 **** - } - } - -- /* -- * Build the distribution from the spec file... -- */ -- -- if (Verbosity) -- puts("Building RPM binary distribution..."); -- -- if (strcmp(platform->machine, "intel") == 0) -- { -- if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "i386 %s", -- Verbosity == 0 ? "--quiet" : "", specname)) -- return (1); -- } -- else if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "%s %s", -- Verbosity == 0 ? "--quiet" : "", platform->machine, -- specname)) -- return (1); -- -- /* -- * Move the RPM to the local directory and rename the RPM using the -- * product name specified by the user... -- */ -- -- if (strcmp(platform->machine, "intel") == 0) -- run_command(NULL, "/bin/mv %s/RPMS/i386/%s-%s-%d.i386.rpm %s/%s.rpm", -- rpmdir, prodname, dist->version, dist->relnumber, -- directory, name); -- else -- run_command(NULL, "/bin/mv %s/RPMS/%s/%s-%s-%d.%s.rpm %s/%s.rpm", -- rpmdir, platform->machine, prodname, dist->version, -- dist->relnumber, platform->machine, directory, name); -- -- /* -- * Remove temporary files... -- */ -- -- if (!KeepFiles) -- { -- if (Verbosity) -- puts("Removing temporary distribution files..."); -- -- run_command(NULL, "/bin/rm -rf %s/RPMS", directory); -- run_command(NULL, "/bin/rm -rf %s/buildroot", directory); -- -- unlink(specname); -- } -- - return (0); - } - ---- 457,462 ---- ++ + /* + * Build the distribution from the spec file... + */ +diff -urN epm-3.7-old//dist.c epm-3.7/dist.c +--- misc/epm-3.7/dist.c 2003-08-07 14:14:40.000000000 +0000 ++++ misc/build/epm-3.7/dist.c 2010-04-19 22:52:32.000000000 +0000 +@@ -394,8 +394,13 @@ + strcpy(platform->machine, "mips"); + #elif defined(__hpux) + strcpy(platform->machine, "hppa"); +-#elif defined(_AIX) || defined(__APPLE__) ++#elif defined(_AIX) + strcpy(platform->machine, "powerpc"); ++#elif defined(__APPLE__) ++ if (strstr(platform->machine, "86") != NULL) ++ strcpy(platform->machine, "intel"); ++ else ++ strcpy(platform->machine, "powerpc"); + #else + for (temp = platform->machine; *temp != '\0'; temp ++) + if (*temp == '-' || *temp == '_') +@@ -407,7 +412,12 @@ + *temp = tolower(*temp); + + if (strstr(platform->machine, "86") != NULL) +- strcpy(platform->machine, "intel"); ++ { ++ if (strstr(platform->machine, "64") != NULL) ++ strcpy(platform->machine, "x86_64"); ++ else ++ strcpy(platform->machine, "intel"); ++ } + else if (strncmp(platform->machine, "sun", 3) == 0) + strcpy(platform->machine, "sparc"); + #endif /* __sgi */ +diff -urN epm-3.7-old//epm.c epm-3.7/epm.c +--- misc/epm-3.7/epm.c 2003-10-28 14:48:30.000000000 +0000 ++++ misc/build/epm-3.7/epm.c 2010-04-19 22:52:32.000000000 +0000 +@@ -547,6 +547,7 @@ + { + puts(EPM_VERSION); + puts("Copyright 1999-2003 by Easy Software Products."); ++ puts("Patched for OpenOffice.org"); + puts(""); + puts("EPM is free software and comes with ABSOLUTELY NO WARRANTY; for details"); + puts("see the GNU General Public License in the file COPYING or at"); +diff -urN epm-3.7-old//file.c epm-3.7/file.c +--- misc/epm-3.7/file.c 2003-07-23 21:41:08.000000000 +0000 ++++ misc/build/epm-3.7/file.c 2010-04-19 22:52:32.000000000 +0000 +@@ -108,7 +108,6 @@ + fclose(dstfile); + + chmod(dst, mode); +- chown(dst, owner, group); + + return (0); + } +@@ -138,7 +137,6 @@ + { + mkdir(buffer, 0777); + chmod(buffer, mode | 0700); +- chown(buffer, owner, group); + } + } + +@@ -151,7 +149,6 @@ + { + mkdir(buffer, 0777); + chmod(buffer, mode | 0700); +- chown(buffer, owner, group); + } + + return (0); +diff -urN epm-3.7-old//osx.c epm-3.7/osx.c +--- misc/epm-3.7/osx.c 2003-07-23 21:41:08.000000000 +0000 ++++ misc/build/epm-3.7/osx.c 2010-04-19 22:52:32.000000000 +0000 +@@ -373,7 +373,7 @@ + else + snprintf(filename, sizeof(filename), "%s/%s", current, directory); + +- run_command(NULL, "/Developer/Applications/PackageMaker.app/" ++ run_command(NULL, "/Developer/Applications/Utilities/PackageMaker.app/" + "Contents/MacOS/PackageMaker -build " + "-p %s/%s.pkg -f %s/Package -r %s/Resources -d %s/%s-desc.plist -i %s/%s-info.plist", + filename, prodname, filename, filename, filename, prodname, filename, prodname); +diff -urN epm-3.7-old//pkg.c epm-3.7/pkg.c +--- misc/epm-3.7/pkg.c 2002-12-17 18:57:56.000000000 +0000 ++++ misc/build/epm-3.7/pkg.c 2010-04-19 22:52:32.000000000 +0000 +@@ -429,75 +429,6 @@ + + fclose(fp); + +- /* +- * Build the distribution from the prototype file... +- */ +- +- if (Verbosity) +- puts("Building PKG binary distribution..."); +- +- if (run_command(NULL, "pkgmk -o -f %s/%s.prototype -d %s/%s", +- directory, prodname, current, directory)) +- return (1); +- +- /* +- * Tar and compress the distribution... +- */ +- +- if (Verbosity) +- puts("Creating tar.gz file for distribution..."); +- +- snprintf(filename, sizeof(filename), "%s/%s.tar.gz", directory, name); +- +- if ((tarfile = tar_open(filename, 1)) == NULL) +- return (1); +- +- snprintf(filename, sizeof(filename), "%s/%s", directory, prodname); +- +- if (tar_directory(tarfile, filename, prodname)) +- { +- tar_close(tarfile); +- return (1); +- } +- +- tar_close(tarfile); +- +- /* +- * Make a package stream file... +- */ +- +- if (Verbosity) +- puts("Copying into package stream file..."); +- +- if (run_command(directory, "pkgtrans -s %s/%s %s.pkg %s", +- current, directory, name, prodname)) +- return (1); +- +- /* +- * Remove temporary files... +- */ +- +- if (!KeepFiles) +- { +- if (Verbosity) +- puts("Removing temporary distribution files..."); +- +- snprintf(filename, sizeof(filename), "%s/%s.pkginfo", directory, prodname); +- unlink(filename); +- snprintf(filename, sizeof(filename), "%s/%s.depend", directory, prodname); +- unlink(filename); +- snprintf(filename, sizeof(filename), "%s/%s.prototype", directory, prodname); +- unlink(filename); +- if (preinstall[0]) +- unlink(preinstall); +- if (postinstall[0]) +- unlink(postinstall); +- if (preremove[0]) +- unlink(preremove); +- if (postremove[0]) +- unlink(postremove); +- } +- + return (0); + } + +diff -urN epm-3.7-old//qprintf.c epm-3.7/qprintf.c +--- misc/epm-3.7-old/qprintf.c 2003-01-27 21:48:03.000000000 +0000 ++++ misc/build/epm-3.7/qprintf.c 2010-04-19 22:52:32.000000000 +0000 +@@ -181,12 +181,19 @@ + + for (i = slen; i > 0; i --, s ++, bytes ++) + { ++#if defined(__FreeBSD__) ++ if (strchr("`~!#%^&*()[{]}\\|;\'\"<>? ", *s)) ++ { ++ putc('\\', fp); ++ bytes ++; ++ } ++#else + if (strchr("`~!#$%^&*()[{]}\\|;\'\"<>? ", *s)) + { + putc('\\', fp); + bytes ++; + } +- ++#endif + putc(*s, fp); + } + +diff -urN epm-3.7-old//rpm.c epm-3.7/rpm.c +--- misc/epm-3.7/rpm.c 2003-10-01 19:27:15.000000000 +0000 ++++ misc/build/epm-3.7/rpm.c 2010-04-19 22:52:32.000000000 +0000 +@@ -38,7 +38,7 @@ + dist_t *dist, /* I - Distribution information */ + struct utsname *platform) /* I - Platform information */ + { +- int i; /* Looping var */ ++ int i,n; /* Looping vars */ + FILE *fp; /* Spec file */ + char name[1024]; /* Full product name */ + char specname[1024]; /* Spec filename */ +@@ -160,6 +160,8 @@ + fprintf(fp, "Requires: %s", dname); + else if (d->type == DEPEND_PROVIDES) + fprintf(fp, "Provides: %s", dname); ++ else if (d->type == DEPEND_REPLACES) ++ fprintf(fp, "Obsoletes: %s", dname); + else + fprintf(fp, "Conflicts: %s", dname); + +@@ -186,15 +188,33 @@ + for (i = 0; i < dist->num_descriptions; i ++) + fprintf(fp, "%s\n", dist->descriptions[i]); + +- fputs("%pre\n", fp); ++ /* ++ * %pre ++ */ ++ n = 0; + for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) ++ { + if (c->type == COMMAND_PRE_INSTALL) ++ { ++ if (1 == ++n) /* Only write %pre if there is at least one command */ ++ fputs("%pre\n", fp); + fprintf(fp, "%s\n", c->command); ++ } ++ } + +- fputs("%post\n", fp); ++ /* ++ * %post ++ */ ++ n = 0; + for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) ++ { + if (c->type == COMMAND_POST_INSTALL) ++ { ++ if (1 == ++n) /* Only write %post if there is at least one command */ ++ fputs("%post\n", fp); + fprintf(fp, "%s\n", c->command); ++ } ++ } + + for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) + if (tolower(file->type) == 'i') +@@ -202,6 +222,8 @@ + + if (i) + { ++ if (1 == ++n) /* If not previously done so, write %post here */ ++ fputs("%post\n", fp); + fputs("if test \"x$1\" = x1; then\n", fp); + fputs(" echo Setting up init scripts...\n", fp); + +@@ -259,13 +281,17 @@ + fputs("fi\n", fp); + } + +- fputs("%preun\n", fp); ++ /* ++ * %preun ++ */ ++ n = 0; + for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) + if (tolower(file->type) == 'i') + break; + + if (i) + { ++ fputs("%preun\n", fp); ++n; /* Need to write %preun here */ + fputs("if test \"x$1\" = x0; then\n", fp); + fputs(" echo Cleaning up init scripts...\n", fp); + +@@ -315,13 +341,29 @@ + } + + for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) ++ { + if (c->type == COMMAND_PRE_REMOVE) ++ { ++ if (1 == ++n) /* Only write %preun if not previously done so */ ++ fputs("%preun\n", fp); ++ + fprintf(fp, "%s\n", c->command); ++ } ++ } + +- fputs("%postun\n", fp); ++ /* ++ * %post ++ */ ++ n = 0; + for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++) ++ { + if (c->type == COMMAND_POST_REMOVE) ++ { ++ if (1 == ++n) /* Only write %post if there is at least one command */ ++ fputs("%postun\n", fp); + fprintf(fp, "%s\n", c->command); ++ } ++ } + + fputs("%files\n", fp); + for (i = dist->num_files, file = dist->files; i > 0; i --, file ++) +@@ -415,53 +457,6 @@ + } + } + +- /* +- * Build the distribution from the spec file... +- */ +- +- if (Verbosity) +- puts("Building RPM binary distribution..."); +- +- if (strcmp(platform->machine, "intel") == 0) +- { +- if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "i386 %s", +- Verbosity == 0 ? "--quiet" : "", specname)) +- return (1); +- } +- else if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "%s %s", +- Verbosity == 0 ? "--quiet" : "", platform->machine, +- specname)) +- return (1); +- +- /* +- * Move the RPM to the local directory and rename the RPM using the +- * product name specified by the user... +- */ +- +- if (strcmp(platform->machine, "intel") == 0) +- run_command(NULL, "/bin/mv %s/RPMS/i386/%s-%s-%d.i386.rpm %s/%s.rpm", +- rpmdir, prodname, dist->version, dist->relnumber, +- directory, name); +- else +- run_command(NULL, "/bin/mv %s/RPMS/%s/%s-%s-%d.%s.rpm %s/%s.rpm", +- rpmdir, platform->machine, prodname, dist->version, +- dist->relnumber, platform->machine, directory, name); +- +- /* +- * Remove temporary files... +- */ +- +- if (!KeepFiles) +- { +- if (Verbosity) +- puts("Removing temporary distribution files..."); +- +- run_command(NULL, "/bin/rm -rf %s/RPMS", directory); +- run_command(NULL, "/bin/rm -rf %s/buildroot", directory); +- +- unlink(specname); +- } +- + return (0); + } + diff --git a/framework/inc/classes/resource.hrc b/framework/inc/classes/resource.hrc index a2bf56376913..8c9bd2e854b0 100644 --- a/framework/inc/classes/resource.hrc +++ b/framework/inc/classes/resource.hrc @@ -55,6 +55,7 @@ #define STR_SET_LANGUAGE_FOR_PARAGRAPH (RID_STR_START+19) #define STR_SET_LANGUAGE_FOR_ALL_TEXT (RID_STR_START+20) #define STR_UNTITLED_DOCUMENT (RID_STR_START+21) +#define STR_RESET_TO_DEFAULT_LANGUAGE (RID_STR_START+22) #define POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION (RID_MENU_START+0) diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx index 96329d4f98b9..6a1886244b54 100644..100755 --- a/framework/inc/helper/mischelper.hxx +++ b/framework/inc/helper/mischelper.hxx @@ -34,10 +34,56 @@ #include <i18npool/lang.h> #include <svl/languageoptions.hxx> +#include <rtl/ustring.hxx> + +#include <set> + +class SvtLanguageTable; + + +// flags for script types in use within selection +#define LS_SCRIPT_LATIN 0x0001 +#define LS_SCRIPT_ASIAN 0x0002 +#define LS_SCRIPT_COMPLEX 0x0004 + namespace framework { +// menu ids for language status bar control +enum LangMenuIDs +{ + MID_LANG_SEL_1 = 1, // need to start with 1 since xPopupMenu->execute will return 0 if the menu is cancelled + MID_LANG_SEL_2, + MID_LANG_SEL_3, + MID_LANG_SEL_4, + MID_LANG_SEL_5, + MID_LANG_SEL_6, + MID_LANG_SEL_7, + MID_LANG_SEL_8, + MID_LANG_SEL_9, + MID_LANG_SEL_NONE, + MID_LANG_SEL_RESET, + MID_LANG_SEL_MORE, + + MID_LANG_PARA_SEPERATOR, + MID_LANG_PARA_STRING, + + MID_LANG_PARA_1, + MID_LANG_PARA_2, + MID_LANG_PARA_3, + MID_LANG_PARA_4, + MID_LANG_PARA_5, + MID_LANG_PARA_6, + MID_LANG_PARA_7, + MID_LANG_PARA_8, + MID_LANG_PARA_9, + MID_LANG_PARA_NONE, + MID_LANG_PARA_RESET, + MID_LANG_PARA_MORE, +}; + + inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang ) { return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); @@ -63,6 +109,15 @@ public: ,sal_Bool& _rIni ,const sal_Char* _pName); +void FillLangItems( std::set< ::rtl::OUString > &rLangItems, + const SvtLanguageTable &rLanguageTable, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame, + const LanguageGuessingHelper & rLangGuessHelper, + sal_Int16 nScriptType, + const ::rtl::OUString & rCurLang, + const ::rtl::OUString & rKeyboardLang, + const ::rtl::OUString & rGuessedTextLang ); + } // namespace framework #endif // __MISC_HELPER_HXX_ diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx index a73a8f13b92e..257638ecd77f 100644 --- a/framework/inc/uielement/langselectionmenucontroller.hxx +++ b/framework/inc/uielement/langselectionmenucontroller.hxx @@ -102,11 +102,10 @@ namespace framework ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_Font; ::rtl::OUString m_aMenuCommandURL_CharDlgForParagraph; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_CharDlgForParagraph; - ::rtl::OUString m_aCurrentLanguage; ::rtl::OUString m_aCurLang; sal_Int16 m_nScriptType; ::rtl::OUString m_aKeyboardLang; - ::rtl::OUString m_aGuessedText; + ::rtl::OUString m_aGuessedTextLang; LanguageGuessingHelper m_aLangGuessHelper; void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const Mode rMode ); diff --git a/framework/inc/uielement/langselectionstatusbarcontroller.hxx b/framework/inc/uielement/langselectionstatusbarcontroller.hxx index 09cd83901b1e..4d46538eb6d6 100644 --- a/framework/inc/uielement/langselectionstatusbarcontroller.hxx +++ b/framework/inc/uielement/langselectionstatusbarcontroller.hxx @@ -35,9 +35,15 @@ #include <stdtypes.h> #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> #include <svtools/statusbarcontroller.hxx> +#include <rtl/ustring.hxx> #include "helper/mischelper.hxx" +#include <set> + +class SvtLanguageTable; + + // component helper namespace namespace framework { @@ -86,12 +92,11 @@ class LangSelectionStatusbarController : public svt::StatusbarController void operator =(LangSelectionStatusbarController &); // not defined - sal_Bool m_bShowMenu; - sal_Int16 m_nScriptType; - ::rtl::OUString m_aCurrentLanguage; - ::rtl::OUString m_aCurLang; - ::rtl::OUString m_aKeyboardLang; - ::rtl::OUString m_aGuessedText; + sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text) + sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004 + ::rtl::OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages + ::rtl::OUString m_aKeyboardLang; // the keyboard language + ::rtl::OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed LanguageGuessingHelper m_aLangGuessHelper; void LangMenu() throw (::com::sun::star::uno::RuntimeException); diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src index d95e0d7213f0..2f8e1bdf2f16 100644 --- a/framework/source/classes/resource.src +++ b/framework/source/classes/resource.src @@ -327,6 +327,11 @@ String STR_LANGSTATUS_NONE Text [ en-US ] = "None (Do not check spelling)" ; Text [ x-comment ] = " "; }; +String STR_RESET_TO_DEFAULT_LANGUAGE +{ + Text [ en-US ] = "Reset to Default Language" ; + Text [ x-comment ] = " "; +}; String STR_LANGSTATUS_MORE { Text [ en-US ] = "More..." ; diff --git a/framework/source/helper/mischelper.cxx b/framework/source/helper/mischelper.cxx index 801714bafcc1..deb5aa023c1b 100644 --- a/framework/source/helper/mischelper.cxx +++ b/framework/source/helper/mischelper.cxx @@ -29,10 +29,15 @@ #include "precompiled_framework.hxx" #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <tools/debug.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <i18npool/mslangid.hxx> +#include <svtools/langtab.hxx> #include <comphelper/processfactory.hxx> #include <helper/mischelper.hxx> #include <services.h> @@ -45,6 +50,9 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; +using ::rtl::OUString; + + namespace framework { @@ -68,20 +76,23 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues return m_xLanguageGuesser; } -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory - ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame - ,::rtl::OUString& _rModuleIdentifier - ,sal_Bool& _rIni - ,const sal_Char* _pName) +//////////////////////////////////////////////////////////// + +::rtl::OUString RetrieveLabelFromCommand( + const ::rtl::OUString& aCmdURL, + const uno::Reference< lang::XMultiServiceFactory >& _xServiceFactory, + uno::Reference< container::XNameAccess >& _xUICommandLabels, + const uno::Reference< frame::XFrame >& _xFrame, + ::rtl::OUString& _rModuleIdentifier, + sal_Bool& _rIni, + const sal_Char* _pName) { ::rtl::OUString aLabel; // Retrieve popup menu labels if ( !_xUICommandLabels.is() ) { - try + try { if ( !_rIni ) { @@ -138,5 +149,91 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues return aLabel; } +//////////////////////////////////////////////////////////// + +void FillLangItems( std::set< OUString > &rLangItems, + const SvtLanguageTable & rLanguageTable, + const uno::Reference< frame::XFrame > & rxFrame, + const LanguageGuessingHelper & rLangGuessHelper, + sal_Int16 nScriptType, + const OUString & rCurLang, + const OUString & rKeyboardLang, + const OUString & rGuessedTextLang ) +{ + rLangItems.clear(); + + //1--add current language + if( rCurLang != OUString() && + LANGUAGE_DONTKNOW != rLanguageTable.GetType( rCurLang )) + rLangItems.insert( rCurLang ); + + //2--System + const AllSettings& rAllSettings = Application::GetSettings(); + LanguageType rSystemLanguage = rAllSettings.GetLanguage(); + if( rSystemLanguage != LANGUAGE_DONTKNOW ) + { + if ( IsScriptTypeMatchingToLanguage( nScriptType, rSystemLanguage )) + rLangItems.insert( OUString( rLanguageTable.GetString( rSystemLanguage )) ); + } + + //3--UI + LanguageType rUILanguage = rAllSettings.GetUILanguage(); + if( rUILanguage != LANGUAGE_DONTKNOW ) + { + if ( IsScriptTypeMatchingToLanguage( nScriptType, rUILanguage )) + rLangItems.insert( OUString( rLanguageTable.GetString( rUILanguage )) ); + } + + //4--guessed language + uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( rLangGuessHelper.GetGuesser() ); + if ( xLangGuesser.is() && rGuessedTextLang.getLength() > 0) + { + ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( rGuessedTextLang, 0, rGuessedTextLang.getLength()) ); + LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); + if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM + && IsScriptTypeMatchingToLanguage( nScriptType, nLang )) + rLangItems.insert( rLanguageTable.GetString( nLang )); + } + + //5--keyboard language + if( rKeyboardLang != OUString()) + { + if ( IsScriptTypeMatchingToLanguage( nScriptType, rLanguageTable.GetType( rKeyboardLang ))) + rLangItems.insert( rKeyboardLang ); + } + + //6--all languages used in current document + Reference< com::sun::star::frame::XModel > xModel; + if ( rxFrame.is() ) + { + Reference< com::sun::star::frame::XController > xController( rxFrame->getController(), UNO_QUERY ); + if ( xController.is() ) + xModel = xController->getModel(); + } + Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); + /*the description of nScriptType + LATIN : 0x001 + ASIAN : 0x002 + COMPLEX: 0x004 + */ + const sal_Int16 nMaxCount = 7; + if ( xDocumentLanguages.is() ) + { + Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount )); + if ( rLocales.getLength() > 0 ) + { + for ( USHORT i = 0; i < rLocales.getLength(); ++i ) + { + if ( rLangItems.size() == static_cast< size_t >(nMaxCount) ) + break; + const Locale& rLocale=rLocales[i]; + if( IsScriptTypeMatchingToLanguage( nScriptType, rLanguageTable.GetType( rLocale.Language ))) + rLangItems.insert( OUString( rLocale.Language ) ); + } + } + } +} + } // namespace framework + diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 4bdc626ee91d..193bd63b5ad5 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -293,11 +293,12 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData )); } } + rElementTypeData.bLoaded = true; } } } - rElementTypeData.bLoaded = true; + //rElementTypeData.bLoaded = true; } void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData ) diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index 0513e164f458..651c9bbfdc86 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" + #include <uielement/langselectionmenucontroller.hxx> //_________________________________________________________________________________________________________________ @@ -63,7 +64,7 @@ #include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> -#include <map> + #include <i18npool/mslangid.hxx> #include <svl/languageoptions.hxx> #include <com/sun/star/awt/MenuItemStyle.hpp> @@ -78,6 +79,9 @@ #include "helper/mischelper.hxx" #include <vos/mutex.hxx> +#include <map> +#include <set> + //_________________________________________________________________________________________________________________ // Defines //_________________________________________________________________________________________________________________ @@ -89,6 +93,7 @@ using namespace com::sun::star::frame; using namespace com::sun::star::beans; using namespace com::sun::star::util; +using ::rtl::OUString; namespace framework { @@ -103,8 +108,8 @@ DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : svt::PopupMenuControllerBase( xServiceManager ), - m_bShowMenu( sal_True ) - ,m_aLangGuessHelper(xServiceManager) + m_bShowMenu( sal_True ), + m_aLangGuessHelper( xServiceManager ) { } @@ -137,25 +142,21 @@ void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureState return; m_bShowMenu = sal_True; - m_nScriptType=7;//set the default value + m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value - rtl::OUString aStrValue; - Sequence< ::rtl::OUString > aSeq; + OUString aStrValue; + Sequence< OUString > aSeq; - if ( Event.State >>= aStrValue ) - { - m_aCurrentLanguage=aStrValue; - } - else if ( Event.State >>= aSeq ) + if ( Event.State >>= aSeq ) { if ( aSeq.getLength() == 4 ) { // Retrieve all other values from the sequence and // store it members! - m_aCurLang=aSeq[0]; - m_nScriptType= static_cast< sal_Int16 >(aSeq[1].toInt32()); - m_aKeyboardLang=aSeq[2]; - m_aGuessedText=aSeq[3]; + m_aCurLang = aSeq[0]; + m_nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); + m_aKeyboardLang = aSeq[2]; + m_aGuessedTextLang = aSeq[3]; } } else if ( !Event.State.hasValue() ) @@ -186,14 +187,14 @@ void LanguageSelectionMenuController::impl_select(const Reference< XDispatch >& { Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); if ( xDispatchProvider.is() ) - xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); } if ( xDispatch.is() ) { Sequence<PropertyValue> aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# - UiEventLogHelper(::rtl::OUString::createFromAscii("LanguageSelectionMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); + UiEventLogHelper( OUString::createFromAscii("LanguageSelectionMenuController")).log( m_xServiceManager, m_xFrame, aTargetURL, aArgs ); xDispatch->dispatch( aTargetURL, aArgs ); } } @@ -208,22 +209,22 @@ void LanguageSelectionMenuController::impl_setPopupMenu() // Register for language updates aTargetURL.Complete = m_aLangStatusCommandURL; m_xURLTransformer->parseStrict( aTargetURL ); - m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); // Register for setting languages and opening language dialog aTargetURL.Complete = m_aMenuCommandURL_Lang; m_xURLTransformer->parseStrict( aTargetURL ); - m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); // Register for opening character dialog aTargetURL.Complete = m_aMenuCommandURL_Font; m_xURLTransformer->parseStrict( aTargetURL ); - m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); // Register for opening character dialog with preselected paragraph aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph; m_xURLTransformer->parseStrict( aTargetURL ); - m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); } void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode ) @@ -245,143 +246,77 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup String aCmd_Language; if( eMode == MODE_SetLanguageSelectionMenu ) { - aCmd_Dialog+=String::CreateFromAscii(".uno:FontDialog?Language:string=*"); - aCmd_Language+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Current_"); + aCmd_Dialog.AppendAscii(".uno:FontDialog?Language:string=*"); + aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Current_"); } else if ( eMode == MODE_SetLanguageParagraphMenu ) { - aCmd_Dialog+=String::CreateFromAscii(".uno:FontDialogForParagraph"); - aCmd_Language+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Paragraph_"); + aCmd_Dialog.AppendAscii(".uno:FontDialogForParagraph"); + aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Paragraph_"); } else if ( eMode == MODE_SetLanguageAllTextMenu ) { - aCmd_Dialog+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=*"); - aCmd_Language+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Default_"); + aCmd_Dialog.AppendAscii(".uno:LanguageStatus?Language:string=*"); + aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Default_"); } - //Reference< awt::XMenuExtended > m_xMenuExtended( m_xPopupMenu, UNO_QUERY ); - std::map< ::rtl::OUString, ::rtl::OUString > LangItems; - - SvtLanguageTable aLanguageTable; - USHORT nItemId = 1; - - //1--add current language - if(m_aCurLang.getLength()) + SvtLanguageTable aLanguageTable; + + // get languages to be displayed in the menu + std::set< OUString > aLangItems; + FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, + m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); + + // + // now add menu entries + // the different menues purpose will be handled by the different string + // for aCmd_Dialog and aCmd_Language + // + + sal_Int16 nItemId = 1; // in this control the item id is not important for executing the command + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::map< sal_Int16, OUString > aLangMap; + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - LangItems[m_aCurLang]=m_aCurLang; - } - - SvtLanguageTable aLangTable; - //2--System - const AllSettings& rAllSettings=Application::GetSettings(); - LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if(rSystemLanguage!=LANGUAGE_DONTKNOW) - { - if (IsScriptTypeMatchingToLanguage(m_nScriptType,rSystemLanguage )) - LangItems[::rtl::OUString(aLangTable.GetString(rSystemLanguage))]=::rtl::OUString(aLangTable.GetString(rSystemLanguage)); - } - - //3--UI - LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if(rUILanguage!=LANGUAGE_DONTKNOW) - { - if (IsScriptTypeMatchingToLanguage(m_nScriptType, rUILanguage )) - LangItems[::rtl::OUString(aLangTable.GetString(rUILanguage))]=::rtl::OUString(aLangTable.GetString(rUILanguage)); - } - - //4--guessed language - uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( m_aLangGuessHelper.GetGuesser() ); - if (xLangGuesser.is() && m_aGuessedText.getLength() > 0) - { - ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) ); - LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); - if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM - && IsScriptTypeMatchingToLanguage( m_nScriptType, nLang )) - LangItems[aLangTable.GetString(nLang)]=aLangTable.GetString(nLang); - } - - //5--keyboard language - if(m_aKeyboardLang!=::rtl::OUString::createFromAscii("")) - { - if (IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(m_aKeyboardLang))) - LangItems[m_aKeyboardLang] = m_aKeyboardLang; - } - - //6--all languages used in current document - Reference< com::sun::star::frame::XModel > xModel; - if ( m_xFrame.is() ) - { - Reference< com::sun::star::frame::XController > xController( m_xFrame->getController(), UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); - /*the description of m_nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 - */ - - sal_Int16 nCount=7; - if(xDocumentLanguages.is()) - { - Sequence< Locale > rLocales(xDocumentLanguages->getDocumentLanguages(m_nScriptType,nCount)); - if(rLocales.getLength()>0) - { - for(USHORT i = 0; i<rLocales.getLength();++i) - { - if (LangItems.size()==7) - break; - const Locale& rLocale=rLocales[i]; - if(IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(rLocale.Language))) - LangItems[rLocale.Language] = rLocale.Language; - } - } - } - std::map< sal_Int16, ::rtl::OUString > LangTable; - - const ::rtl::OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); - bool bMultipleLanguages = (eMode != MODE_SetLanguageSelectionMenu) || m_aCurLang.compareToAscii( "*" ) == 0; - bool bNothingSelected = true; - MenuItemBits nItemBits = !bMultipleLanguages ? MIB_RADIOCHECK : 0; - for(std::map< ::rtl::OUString, ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it) - { - if(it->first != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - it->first != sAsterix && - it->first.getLength()) + const OUString & rStr( *it ); + if (rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + rStr != sAsterix && + rStr != sEmpty) { - ++nItemId; - pPopupMenu->InsertItem( nItemId,it->first,nItemBits ); - LangTable[nItemId] = it->first; - if(it->first == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) + pPopupMenu->InsertItem( nItemId, rStr ); + aCmd = aCmd_Language; + aCmd += String( rStr ); + pPopupMenu->SetItemCommand( nItemId, aCmd ); + if (rStr == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) { //make a sign for the current language - pPopupMenu->CheckItem(nItemId,TRUE); - bNothingSelected = false; + pPopupMenu->CheckItem( nItemId, TRUE ); } - aCmd=aCmd_Language; - aCmd+=(String)it->first; - pPopupMenu->SetItemCommand(nItemId,aCmd); + aLangMap[ nItemId ] = rStr; + ++nItemId; } } - //7--none - nItemId++; - pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )), nItemBits ); - if (bNothingSelected && !bMultipleLanguages) - pPopupMenu->CheckItem(nItemId,TRUE); + // entry for LANGUAGE_NONE + ++nItemId; + pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) ); + aCmd=aCmd_Language; + aCmd.AppendAscii("LANGUAGE_NONE"); + pPopupMenu->SetItemCommand( nItemId, aCmd ); + + // entry for 'Reset to default language' + ++nItemId; + pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_RESET_TO_DEFAULT_LANGUAGE )) ); aCmd=aCmd_Language; - aCmd+=String::CreateFromAscii("LANGUAGE_NONE"); - pPopupMenu->SetItemCommand(nItemId,aCmd); + aCmd.AppendAscii("RESET_LANGUAGES"); + pPopupMenu->SetItemCommand( nItemId, aCmd ); - //More... - nItemId++; + // entry for opening the Format/Character dialog + ++nItemId; pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_MORE ))); - pPopupMenu->SetItemCommand(nItemId,aCmd_Dialog); + pPopupMenu->SetItemCommand( nItemId, aCmd_Dialog ); } @@ -431,10 +366,10 @@ void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any > if ( m_bInitialized ) { - m_aLangStatusCommandURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); + m_aLangStatusCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); m_aMenuCommandURL_Lang = m_aLangStatusCommandURL; - m_aMenuCommandURL_Font = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); - m_aMenuCommandURL_CharDlgForParagraph = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); + m_aMenuCommandURL_Font = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); + m_aMenuCommandURL_CharDlgForParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); } } } diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index 544597261852..021ee4e8f8df 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" + #include <uielement/langselectionstatusbarcontroller.hxx> #include <classes/fwkresid.hxx> #include <services.h> @@ -53,8 +54,6 @@ #include <com/sun/star/frame/XModule.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <map> -#include <set> #include <classes/fwkresid.hxx> #ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_ #include <classes/resource.hrc> @@ -74,6 +73,9 @@ #include "helper/mischelper.hxx" +#include <map> +#include <set> + using namespace ::cppu; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -82,9 +84,14 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::document; +using ::rtl::OUString; + + namespace framework { +//////////////////////////////////////////////////////////// + DEFINE_XSERVICEINFO_MULTISERVICE ( LangSelectionStatusbarController , OWeakObject , SERVICENAME_STATUSBARCONTROLLER , @@ -94,10 +101,10 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( LangSelectionStatusbarController DEFINE_INIT_SERVICE ( LangSelectionStatusbarController, {} ) LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) : - svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 ), + svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), OUString(), 0 ), m_bShowMenu( sal_True ), - m_nScriptType( 7 ) - ,m_aLangGuessHelper(xServiceManager) + m_nScriptType( LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX ), + m_aLangGuessHelper( xServiceManager ) { } @@ -178,223 +185,158 @@ throw (::com::sun::star::uno::RuntimeException) return sal_False; } -void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::RuntimeException) +void LangSelectionStatusbarController::LangMenu() +throw (::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::LangMenu" ); if (!m_bShowMenu) return; //add context menu - const static ::rtl::OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu")); + const static OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu")); Reference< awt::XPopupMenu > xPopupMenu( m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY ); //sub menu that contains all items except the last two items: Separator + Set Language for Paragraph Reference< awt::XPopupMenu > subPopupMenu(m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY ); - std::set< ::rtl::OUString > LangItems; - - SvtLanguageTable aLanguageTable; - USHORT nItemId=1; - - //1--add current language - if( m_aCurLang != ::rtl::OUString( ) && - LANGUAGE_DONTKNOW != aLanguageTable.GetType( m_aCurLang )) - LangItems.insert( m_aCurLang ); - - //2--System - SvtLanguageTable aLangTable; - const AllSettings& rAllSettings = Application::GetSettings(); - LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if( rSystemLanguage != LANGUAGE_DONTKNOW ) - { - if ( IsScriptTypeMatchingToLanguage( m_nScriptType, rSystemLanguage )) - LangItems.insert( ::rtl::OUString( aLangTable.GetString( rSystemLanguage )) ); - } - - //3--UI - LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if( rUILanguage != LANGUAGE_DONTKNOW ) - { - if ( IsScriptTypeMatchingToLanguage( m_nScriptType, rUILanguage )) - LangItems.insert( ::rtl::OUString( aLangTable.GetString( rUILanguage )) ); - } - - //4--guessed language - uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( m_aLangGuessHelper.GetGuesser() ); - if ( xLangGuesser.is() && m_aGuessedText.getLength() > 0) - { - ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) ); - LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); - if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM - && IsScriptTypeMatchingToLanguage( m_nScriptType, nLang )) - LangItems.insert( aLangTable.GetString( nLang )); - } - - //5--keyboard language - if( m_aKeyboardLang != ::rtl::OUString::createFromAscii( "" )) + SvtLanguageTable aLanguageTable; + + // get languages to be displayed in the menu + std::set< OUString > aLangItems; + FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, + m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); + + // + // add first few entries to main menu + // + sal_Int16 nItemId = static_cast< sal_Int16 >(MID_LANG_SEL_1); + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::map< sal_Int16, OUString > aLangMap; + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - if ( IsScriptTypeMatchingToLanguage( m_nScriptType, aLanguageTable.GetType( m_aKeyboardLang ))) - LangItems.insert( m_aKeyboardLang ); - } - - //6--all languages used in current document - Reference< com::sun::star::frame::XModel > xModel; - if ( m_xFrame.is() ) - { - Reference< com::sun::star::frame::XController > xController( m_xFrame->getController(), UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); - /*the description of m_nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 - */ - - sal_Int16 nCount=7; - if ( xDocumentLanguages.is() ) - { - Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( m_nScriptType, nCount )); - if ( rLocales.getLength() > 0 ) - { - for ( USHORT i = 0; i<rLocales.getLength();++i ) - { - if ( LangItems.size() == 7 ) - break; - const Locale& rLocale=rLocales[i]; - if( IsScriptTypeMatchingToLanguage( m_nScriptType, aLangTable.GetType( rLocale.Language ))) - LangItems.insert( ::rtl::OUString( rLocale.Language ) ); - } - } - } - std::map< sal_Int16, ::rtl::OUString > LangTable; - bool bMultipleLanguages = m_aCurLang.compareToAscii( "*" ) == 0; - bool bNothingSelected = true; - sal_Int16 nMenuItemStyle = !bMultipleLanguages ? css::awt::MenuItemStyle::RADIOCHECK : 0; - - for( std::set< ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it ) - { - if ( *it != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - *it != ::rtl::OUString::createFromAscii( "*" ) && - *it != ::rtl::OUString::createFromAscii( "" )) + const OUString & rStr( *it ); + if ( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) ) && + rStr != sAsterix && + rStr != sEmpty) { - //nItemId = xPopupMenu->getItemCount()+1; - nItemId++; - xPopupMenu->insertItem( nItemId, *it, nMenuItemStyle, nItemId ); - LangTable[nItemId]=*it; - if( *it == m_aCurLang ) + DBG_ASSERT( MID_LANG_SEL_1 <= nItemId && nItemId <= MID_LANG_SEL_9, + "nItemId outside of expected range!" ); + xPopupMenu->insertItem( nItemId, rStr, css::awt::MenuItemStyle::RADIOCHECK, nItemId ); + if ( rStr == m_aCurLang ) { //make a sign for the current language xPopupMenu->checkItem( nItemId, TRUE ); - bNothingSelected = false; } + aLangMap[ nItemId ] = rStr; + ++nItemId; } } - - //7--none - nItemId++; - xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), nMenuItemStyle, nItemId ); - if (bNothingSelected && !bMultipleLanguages) - xPopupMenu->checkItem( nItemId, TRUE ); - - //More... - nItemId++; - xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), 0, nItemId ); - - for( ::std::set< ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it ) + xPopupMenu->insertItem( MID_LANG_SEL_NONE, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_NONE ); + xPopupMenu->insertItem( MID_LANG_SEL_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_RESET ); + xPopupMenu->insertItem( MID_LANG_SEL_MORE, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_MORE ); + + // + // add entries to submenu ('set language for paragraph') + // + nItemId = static_cast< sal_Int16 >(MID_LANG_PARA_1); + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - if( *it != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - *it != ::rtl::OUString::createFromAscii( "*" ) && - *it != ::rtl::OUString::createFromAscii( "" )) + const OUString & rStr( *it ); + if( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + rStr != sAsterix && + rStr != sEmpty) { - nItemId++; - subPopupMenu->insertItem( nItemId, *it, 0, nItemId ); - LangTable[nItemId]=*it; + DBG_ASSERT( MID_LANG_PARA_1 <= nItemId && nItemId <= MID_LANG_PARA_9, + "nItemId outside of expected range!" ); + subPopupMenu->insertItem( nItemId, rStr, css::awt::MenuItemStyle::RADIOCHECK, nItemId ); + aLangMap[nItemId] = rStr; + ++nItemId; } } - //7--none - nItemId++; - subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), 0, nItemId ); - //More - nItemId++; - subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), 0, nItemId ); + subPopupMenu->insertItem( MID_LANG_PARA_NONE, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_NONE ); + subPopupMenu->insertItem( MID_LANG_PARA_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_RESET ); + subPopupMenu->insertItem( MID_LANG_PARA_MORE, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_MORE ); - nItemId++; - xPopupMenu->insertSeparator(nItemId); + // + // add last two entries to main menu + // + xPopupMenu->insertSeparator( MID_LANG_PARA_SEPERATOR ); + xPopupMenu->insertItem( MID_LANG_PARA_STRING, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_STRING ); + xPopupMenu->setPopupMenu( MID_LANG_PARA_STRING, subPopupMenu ); - nItemId++; - xPopupMenu->insertItem( nItemId, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), 0, nItemId ); - xPopupMenu->setPopupMenu( nItemId, subPopupMenu ); - //display the popup menu and execute every command + // + // now display the popup menu and execute every command ... + // Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY ); - com::sun::star::awt::Rectangle mRectangle; + com::sun::star::awt::Rectangle aRectangle; Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow ); const Point mMousePos = pWindow->GetPointerPosPixel(); - mRectangle.X = mMousePos.X(); - mRectangle.Y = mMousePos.Y(); - sal_Int16 nId = xPopupMenu->execute( xParent, mRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); + aRectangle.X = mMousePos.X(); + aRectangle.Y = mMousePos.Y(); + sal_Int16 nId = xPopupMenu->execute( xParent, aRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); //click "More..." if ( nId && m_xFrame.is() ) { uno::Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); util::URL aURL; - if ( nId < nItemId-3-subPopupMenu->getItemCount() ) + if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9) { - //1..7 //set selected language as current language for selection - String SelectedLang = LangTable[nId]; - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Current_"); - aURL.Complete+=SelectedLang; + String aSelectedLang = aLangMap[nId]; + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Current_"); + aURL.Complete += aSelectedLang; } - else if ( nId == nItemId-3-subPopupMenu->getItemCount() ) + else if (nId == MID_LANG_SEL_NONE) { - //8 //set None as current language for selection - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"); + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"); + } + else if (nId == MID_LANG_SEL_RESET) + { + // reset language attributes for selection + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES"); } - else if ( nId == nItemId-2-subPopupMenu->getItemCount() ) + else if (nId == MID_LANG_SEL_MORE) { - //9 (more)... //open the dialog "format/character" for current selection - aURL.Complete+=String::CreateFromAscii(".uno:FontDialog?Language:string=*"); + aURL.Complete += OUString::createFromAscii(".uno:FontDialog?Language:string=*"); } - else if ( nId < nItemId-3 && nId>nItemId-2-subPopupMenu->getItemCount() ) + else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9) { - //1..7 para //set selected language for current paragraph - String SelectedLang = LangTable[nId]; - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Paragraph_"); - aURL.Complete+=SelectedLang; + String aSelectedLang = aLangMap[nId]; + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Paragraph_"); + aURL.Complete += aSelectedLang; } - else if ( nId==nItemId-3 ) + else if (nId == MID_LANG_PARA_NONE) { - //8 para //set None as language for current paragraph - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"); + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"); } - else if ( nId==nItemId-2 ) + else if (nId == MID_LANG_PARA_RESET) + { + // reset language attributes for paragraph + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES"); + } + else if (nId == MID_LANG_PARA_MORE) { - //9 (more) para... //open the dialog "format/character" for current paragraph - aURL.Complete+=String::CreateFromAscii(".uno:FontDialogForParagraph"); + aURL.Complete += OUString::createFromAscii(".uno:FontDialogForParagraph"); } - uno::Reference< util::XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); + uno::Reference< util::XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); xURLTransformer->parseStrict( aURL ); - uno::Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL,::rtl::OUString(),0); + uno::Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, OUString(), 0); if( xDispatch.is() ) { uno::Sequence< beans::PropertyValue > aPV; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# - UiEventLogHelper(::rtl::OUString::createFromAscii("ButtonToolbarController")).log(m_xServiceManager, m_xFrame, aURL, aPV); + UiEventLogHelper( OUString::createFromAscii("ButtonToolbarController")).log(m_xServiceManager, m_xFrame, aURL, aPV); xDispatch->dispatch( aURL, aPV); } } @@ -443,6 +385,13 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL LangSelectionStatusbarController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { + // This function will be called when observed data changes, + // for example the selection or keyboard language. + // - It displays the language in use in the status bar + // - and it stores the relevant data for creating the menu + // at some later point in the member variables + // m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedText + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::statusChanged" ); vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); @@ -451,25 +400,22 @@ throw ( RuntimeException ) m_bShowMenu = sal_True; - m_nScriptType=7;//set the default value + m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow ); if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR && m_nID != 0 ) { - rtl::OUString aStrValue; - Sequence< ::rtl::OUString > aSeq; + OUString aStrValue; + Sequence< OUString > aSeq; StatusBar* pStatusBar = (StatusBar *)pWindow; if ( Event.State >>= aStrValue ) - { pStatusBar->SetItemText( m_nID, aStrValue ); - m_aCurrentLanguage = aStrValue; - } else if ( Event.State >>= aSeq ) { if ( aSeq.getLength() == 4 ) { const String aMultipleLangText( FwkResId( STR_LANGSTATUS_MULTIPLE_LANGUAGES ) ); - ::rtl::OUString aStatusText = aSeq[0]; + OUString aStatusText = aSeq[0]; if ( 0 == aStatusText.compareToAscii( "*" )) aStatusText = aMultipleLangText; pStatusBar->SetItemText( m_nID, aStatusText ); @@ -479,7 +425,7 @@ throw ( RuntimeException ) m_aCurLang = aSeq[0]; m_nScriptType = static_cast< sal_Int16 >( aSeq[1].toInt32() ); m_aKeyboardLang = aSeq[2]; - m_aGuessedText = aSeq[3]; + m_aGuessedTextLang = aSeq[3]; } } else if ( !Event.State.hasValue() ) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 55cb3c0aea3c..6a65b9986f1e 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -113,6 +113,9 @@ SHL1STDLIBS= \ $(UNOTOOLSLIB) \ $(CPPUHELPERLIB) \ $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(I18NISOLANGLIB) \ $(VOSLIB) \ $(VCLLIB) \ $(TKLIB) \ @@ -205,7 +208,6 @@ SHL3STDLIBS= \ $(SVTOOLLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(COMPHELPERLIB) \ diff --git a/hunspell/hunspell-1.2.8-thesfix.patch b/hunspell/hunspell-1.2.8-thesfix.patch new file mode 100644 index 000000000000..c41fde45050f --- /dev/null +++ b/hunspell/hunspell-1.2.8-thesfix.patch @@ -0,0 +1,28 @@ +--- misc/hunspell-1.2.8/src/hunspell/hunspell.cxx 2010-03-16 14:37:36.998879385 +0100 ++++ misc/build/hunspell-1.2.8/src/hunspell/hunspell.cxx 2010-03-16 14:37:10.416222464 +0100 +@@ -1666,7 +1666,7 @@ + if (!q2) return 0; // bad XML input + if (check_xml_par(q, "type=", "analyze")) { + int n = 0, s = 0; +- if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN)) n = analyze(slst, cw); ++ if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) n = analyze(slst, cw); + if (n == 0) return 0; + // convert the result to <code><a>ana1</a><a>ana2</a></code> format + for (int i = 0; i < n; i++) s+= strlen((*slst)[i]); +@@ -1687,13 +1687,13 @@ + (*slst)[0] = r; + return 1; + } else if (check_xml_par(q, "type=", "stem")) { +- if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN)) return stem(slst, cw); ++ if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw); + } else if (check_xml_par(q, "type=", "generate")) { +- int n = get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN); ++ int n = get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1); + if (n == 0) return 0; + char * q3 = strstr(q2 + 1, "<word"); + if (q3) { +- if (get_xml_par(cw2, strchr(q3, '>'), MAXWORDUTF8LEN)) { ++ if (get_xml_par(cw2, strchr(q3, '>'), MAXWORDUTF8LEN - 1)) { + return generate(slst, cw, cw2); + } + } else { diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index a03b61a90194..3d474a0a53dc 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -90,6 +90,31 @@ public: }; #endif + +#if defined( TRANSLITERATION_ALL ) +class Transliteration_togglecase : public Transliteration_body +{ +public: + Transliteration_togglecase(); +}; + +class Transliteration_titlecase : public Transliteration_body +{ +public: + Transliteration_titlecase(); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); +}; + +class Transliteration_sentencecase : public Transliteration_body +{ +public: + Transliteration_sentencecase(); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); +}; +#endif + } } } } #endif diff --git a/i18npool/source/localedata/data/ak_GH.xml b/i18npool/source/localedata/data/ak_GH.xml index 95ac2069db31..afdbf1c2b227 100644 --- a/i18npool/source/localedata/data/ak_GH.xml +++ b/i18npool/source/localedata/data/ak_GH.xml @@ -337,8 +337,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/bs_BA.xml b/i18npool/source/localedata/data/bs_BA.xml index 1a6eeb82ff44..0dea5e435ec5 100644 --- a/i18npool/source/localedata/data/bs_BA.xml +++ b/i18npool/source/localedata/data/bs_BA.xml @@ -366,9 +366,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/ee_GH.xml b/i18npool/source/localedata/data/ee_GH.xml index eb19dec770da..2d4807774a8b 100644 --- a/i18npool/source/localedata/data/ee_GH.xml +++ b/i18npool/source/localedata/data/ee_GH.xml @@ -331,8 +331,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/en_GH.xml b/i18npool/source/localedata/data/en_GH.xml index 660cd759944b..37437468a651 100644 --- a/i18npool/source/localedata/data/en_GH.xml +++ b/i18npool/source/localedata/data/en_GH.xml @@ -329,11 +329,7 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION> - <Transliteration unoid="LOWERCASE_UPPERCASE" /> - <Transliteration unoid="UPPERCASE_LOWERCASE" /> - <Transliteration unoid="IGNORE_CASE" /> - </LC_TRANSLITERATION> +<LC_TRANSLITERATION ref="en_US"/> <LC_MISC> <ReservedWords> <trueWord>True</trueWord> diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml index 2a99dcd0fb14..7029b7cc5b30 100644 --- a/i18npool/source/localedata/data/en_US.xml +++ b/i18npool/source/localedata/data/en_US.xml @@ -475,8 +475,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml index 62098fdf75ef..33a42a8fd675 100644 --- a/i18npool/source/localedata/data/eo.xml +++ b/i18npool/source/localedata/data/eo.xml @@ -321,8 +321,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/eu.xml b/i18npool/source/localedata/data/eu.xml index 5f0119b1285d..64184d0125f0 100644 --- a/i18npool/source/localedata/data/eu.xml +++ b/i18npool/source/localedata/data/eu.xml @@ -328,9 +328,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/fur_IT.xml b/i18npool/source/localedata/data/fur_IT.xml index cfec124d68b6..5aee7cbfdf15 100644 --- a/i18npool/source/localedata/data/fur_IT.xml +++ b/i18npool/source/localedata/data/fur_IT.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/fy_NL.xml b/i18npool/source/localedata/data/fy_NL.xml index 651d13417842..a4a7cc48f2da 100644 --- a/i18npool/source/localedata/data/fy_NL.xml +++ b/i18npool/source/localedata/data/fy_NL.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/gsc_FR.xml b/i18npool/source/localedata/data/gsc_FR.xml index 0a13281f9d7b..01242e586e7a 100644 --- a/i18npool/source/localedata/data/gsc_FR.xml +++ b/i18npool/source/localedata/data/gsc_FR.xml @@ -323,9 +323,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> @@ -355,4 +358,4 @@ </LC_NumberingLevel> <LC_OutLineNumberingLevel ref="en_US"/> </Locale> -<!--Version 1.0 -->
\ No newline at end of file +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/gug_PY.xml b/i18npool/source/localedata/data/gug_PY.xml index c21104c3d13e..60230ae64dac 100644 --- a/i18npool/source/localedata/data/gug_PY.xml +++ b/i18npool/source/localedata/data/gug_PY.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ha_GH.xml b/i18npool/source/localedata/data/ha_GH.xml index 1794447c0e4d..6d56b80cc580 100644 --- a/i18npool/source/localedata/data/ha_GH.xml +++ b/i18npool/source/localedata/data/ha_GH.xml @@ -334,8 +334,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/hil_PH.xml b/i18npool/source/localedata/data/hil_PH.xml index 6396ff261c90..1bd10219d366 100644 --- a/i18npool/source/localedata/data/hil_PH.xml +++ b/i18npool/source/localedata/data/hil_PH.xml @@ -324,8 +324,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/hr_HR.xml b/i18npool/source/localedata/data/hr_HR.xml index 4c3786539b38..484efdcb9ba0 100644 --- a/i18npool/source/localedata/data/hr_HR.xml +++ b/i18npool/source/localedata/data/hr_HR.xml @@ -318,9 +318,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/hy_AM.xml b/i18npool/source/localedata/data/hy_AM.xml index 92913732a090..47c2e35d6e7b 100644 --- a/i18npool/source/localedata/data/hy_AM.xml +++ b/i18npool/source/localedata/data/hy_AM.xml @@ -320,8 +320,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/is_IS.xml b/i18npool/source/localedata/data/is_IS.xml index 7e77c1d2cdad..3b16c6e4bca5 100644 --- a/i18npool/source/localedata/data/is_IS.xml +++ b/i18npool/source/localedata/data/is_IS.xml @@ -314,9 +314,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/ka_GE.xml b/i18npool/source/localedata/data/ka_GE.xml index d0a9a20369e1..ada35b465543 100644 --- a/i18npool/source/localedata/data/ka_GE.xml +++ b/i18npool/source/localedata/data/ka_GE.xml @@ -320,8 +320,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/kk_KZ.xml b/i18npool/source/localedata/data/kk_KZ.xml index e5c8cc95d2fe..a9147655cdec 100644 --- a/i18npool/source/localedata/data/kk_KZ.xml +++ b/i18npool/source/localedata/data/kk_KZ.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/km_KH.xml b/i18npool/source/localedata/data/km_KH.xml index dff43def273b..bddd0e91791e 100644 --- a/i18npool/source/localedata/data/km_KH.xml +++ b/i18npool/source/localedata/data/km_KH.xml @@ -346,8 +346,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ko_KR.xml b/i18npool/source/localedata/data/ko_KR.xml index bbd5b0ded2be..3a3fbb0fb9a9 100644 --- a/i18npool/source/localedata/data/ko_KR.xml +++ b/i18npool/source/localedata/data/ko_KR.xml @@ -564,8 +564,11 @@ <Transliteration unoid="IGNORE_WIDTH"/> <Transliteration unoid="FULLWIDTH_HALFWIDTH"/> <Transliteration unoid="HALFWIDTH_FULLWIDTH"/> - <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="NumToTextFormalHangul_ko"/> <Transliteration unoid="NumToTextFormalLower_ko"/> <Transliteration unoid="NumToTextFormalUpper_ko"/> diff --git a/i18npool/source/localedata/data/ku_TR.xml b/i18npool/source/localedata/data/ku_TR.xml index 4af9e2cd28d2..0413353b8486 100644 --- a/i18npool/source/localedata/data/ku_TR.xml +++ b/i18npool/source/localedata/data/ku_TR.xml @@ -330,8 +330,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/lg_UG.xml b/i18npool/source/localedata/data/lg_UG.xml index c6b3b740b10d..5fc78c71cec2 100644 --- a/i18npool/source/localedata/data/lg_UG.xml +++ b/i18npool/source/localedata/data/lg_UG.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> - <Transliteration unoid="LOWERCASE_UPPERCASE" /> - <Transliteration unoid="UPPERCASE_LOWERCASE" /> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE" /> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ln_CD.xml b/i18npool/source/localedata/data/ln_CD.xml index 602b19fb8fd8..daf7376c9df5 100644 --- a/i18npool/source/localedata/data/ln_CD.xml +++ b/i18npool/source/localedata/data/ln_CD.xml @@ -327,8 +327,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/lt_LT.xml b/i18npool/source/localedata/data/lt_LT.xml index c23f542d6b5d..cd4cb0aca929 100644 --- a/i18npool/source/localedata/data/lt_LT.xml +++ b/i18npool/source/localedata/data/lt_LT.xml @@ -346,9 +346,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml index 27bb0f13e409..ab76b4930bc6 100644 --- a/i18npool/source/localedata/data/lv_LV.xml +++ b/i18npool/source/localedata/data/lv_LV.xml @@ -325,6 +325,8 @@ </LC_CURRENCY> <LC_TRANSLITERATION> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE" /> </LC_TRANSLITERATION> diff --git a/i18npool/source/localedata/data/mk_MK.xml b/i18npool/source/localedata/data/mk_MK.xml index b9862478513e..10e488e3cac1 100644 --- a/i18npool/source/localedata/data/mk_MK.xml +++ b/i18npool/source/localedata/data/mk_MK.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/mt_MT.xml b/i18npool/source/localedata/data/mt_MT.xml index 790bd97303e0..bcc5869932b4 100644 --- a/i18npool/source/localedata/data/mt_MT.xml +++ b/i18npool/source/localedata/data/mt_MT.xml @@ -324,8 +324,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml index dada8a5402d9..6c12c8986c8f 100644 --- a/i18npool/source/localedata/data/my_MM.xml +++ b/i18npool/source/localedata/data/my_MM.xml @@ -395,8 +395,11 @@ </LC_CURRENCY> <LC_TRANSLITERATION> <!-- There is often English mixed with Myanmar, so leave these in for now --> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/ne_NP.xml b/i18npool/source/localedata/data/ne_NP.xml index cca8be996a70..558027ac0e1c 100644 --- a/i18npool/source/localedata/data/ne_NP.xml +++ b/i18npool/source/localedata/data/ne_NP.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml index ef3dd47c0dc6..c64fe872c6e8 100644 --- a/i18npool/source/localedata/data/oc_FR.xml +++ b/i18npool/source/localedata/data/oc_FR.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/or_IN.xml b/i18npool/source/localedata/data/or_IN.xml index 168b542f1894..22333451f6ea 100644 --- a/i18npool/source/localedata/data/or_IN.xml +++ b/i18npool/source/localedata/data/or_IN.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sg_CF.xml b/i18npool/source/localedata/data/sg_CF.xml index 075b1a43ae18..61ee40b8081e 100644 --- a/i18npool/source/localedata/data/sg_CF.xml +++ b/i18npool/source/localedata/data/sg_CF.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sh_RS.xml b/i18npool/source/localedata/data/sh_RS.xml index 4b744bdd5913..01faa188c9e2 100644 --- a/i18npool/source/localedata/data/sh_RS.xml +++ b/i18npool/source/localedata/data/sh_RS.xml @@ -211,8 +211,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml index c7e46fa3453d..cfd01f31ac0d 100644 --- a/i18npool/source/localedata/data/shs_CA.xml +++ b/i18npool/source/localedata/data/shs_CA.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sk_SK.xml b/i18npool/source/localedata/data/sk_SK.xml index 7820ef290a46..b233f3981284 100644 --- a/i18npool/source/localedata/data/sk_SK.xml +++ b/i18npool/source/localedata/data/sk_SK.xml @@ -369,9 +369,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> - <Transliteration unoid="LOWERCASE_UPPERCASE" /> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/sl_SI.xml b/i18npool/source/localedata/data/sl_SI.xml index b4de5c4a184b..19139d5e0cc0 100644 --- a/i18npool/source/localedata/data/sl_SI.xml +++ b/i18npool/source/localedata/data/sl_SI.xml @@ -331,8 +331,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml index 981cb54aff3e..e332e2b07d52 100644 --- a/i18npool/source/localedata/data/so_SO.xml +++ b/i18npool/source/localedata/data/so_SO.xml @@ -330,8 +330,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sr_RS.xml b/i18npool/source/localedata/data/sr_RS.xml index 4023c2d4afeb..13133333f37e 100644 --- a/i18npool/source/localedata/data/sr_RS.xml +++ b/i18npool/source/localedata/data/sr_RS.xml @@ -350,8 +350,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/sw_TZ.xml b/i18npool/source/localedata/data/sw_TZ.xml index 22bf61807a54..3a92d8eb3593 100644 --- a/i18npool/source/localedata/data/sw_TZ.xml +++ b/i18npool/source/localedata/data/sw_TZ.xml @@ -322,8 +322,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/tk_TM.xml b/i18npool/source/localedata/data/tk_TM.xml index cfd09c63c4ab..c30d1f782811 100644 --- a/i18npool/source/localedata/data/tk_TM.xml +++ b/i18npool/source/localedata/data/tk_TM.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/tpi_PG.xml b/i18npool/source/localedata/data/tpi_PG.xml index 0017a1081233..51cc3500cc57 100644 --- a/i18npool/source/localedata/data/tpi_PG.xml +++ b/i18npool/source/localedata/data/tpi_PG.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/uk_UA.xml b/i18npool/source/localedata/data/uk_UA.xml index 981c24f7c94f..1025096c7a6a 100644 --- a/i18npool/source/localedata/data/uk_UA.xml +++ b/i18npool/source/localedata/data/uk_UA.xml @@ -369,9 +369,12 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="IGNORE_CASE"/> -<Transliteration unoid="LOWERCASE_UPPERCASE" /> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/localedata/data/vi_VN.xml b/i18npool/source/localedata/data/vi_VN.xml index 4b9bfb266051..93fc1ee3adc4 100644 --- a/i18npool/source/localedata/data/vi_VN.xml +++ b/i18npool/source/localedata/data/vi_VN.xml @@ -323,8 +323,11 @@ </Currency> </LC_CURRENCY> <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> <Transliteration unoid="LOWERCASE_UPPERCASE"/> <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> </LC_TRANSLITERATION> <LC_MISC> diff --git a/i18npool/source/localedata/data/zh_CN.xml b/i18npool/source/localedata/data/zh_CN.xml index 0fadbf5d9075..c9d1371cb753 100644 --- a/i18npool/source/localedata/data/zh_CN.xml +++ b/i18npool/source/localedata/data/zh_CN.xml @@ -415,16 +415,19 @@ <!--more currency should be put here --> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="UPPERCASE_LOWERCASE"/> -<Transliteration unoid="LOWERCASE_UPPERCASE"/> -<Transliteration unoid="HALFWIDTH_FULLWIDTH"/> -<Transliteration unoid="FULLWIDTH_HALFWIDTH"/> -<Transliteration unoid="NumToTextLower_zh_CN"/> -<Transliteration unoid="NumToTextUpper_zh_CN"/> -<Transliteration unoid="NumToCharLower_zh_CN"/> -<Transliteration unoid="NumToCharUpper_zh_CN"/> -<Transliteration unoid="IGNORE_CASE"/> -<Transliteration unoid="IGNORE_WIDTH"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="NumToTextLower_zh_CN"/> + <Transliteration unoid="NumToTextUpper_zh_CN"/> + <Transliteration unoid="NumToCharLower_zh_CN"/> + <Transliteration unoid="NumToCharUpper_zh_CN"/> + <Transliteration unoid="HALFWIDTH_FULLWIDTH"/> + <Transliteration unoid="FULLWIDTH_HALFWIDTH"/> + <Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="IGNORE_WIDTH"/> </LC_TRANSLITERATION> <LC_MISC> <ForbiddenCharacters> diff --git a/i18npool/source/localedata/data/zh_TW.xml b/i18npool/source/localedata/data/zh_TW.xml index 1d1e476b7771..aa53647057f8 100644 --- a/i18npool/source/localedata/data/zh_TW.xml +++ b/i18npool/source/localedata/data/zh_TW.xml @@ -343,17 +343,20 @@ <!--more currency should be put here --> </LC_CURRENCY> <LC_TRANSLITERATION> -<Transliteration unoid="NumToTextLower_zh_TW" /> -<Transliteration unoid="NumToTextUpper_zh_TW" /> -<Transliteration unoid="NumToCharLower_zh_TW" /> -<Transliteration unoid="NumToCharUpper_zh_TW" /> -<Transliteration unoid="TextToChuyin_zh_TW" /> -<Transliteration unoid="IGNORE_CASE" /> -<Transliteration unoid="UPPERCASE_LOWERCASE" /> -<Transliteration unoid="LOWERCASE_UPPERCASE" /> -<Transliteration unoid="IGNORE_WIDTH" /> -<Transliteration unoid="HALFWIDTH_FULLWIDTH"/> -<Transliteration unoid="HALFWIDTH_FULLWIDTH"/> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="NumToTextLower_zh_TW" /> + <Transliteration unoid="NumToTextUpper_zh_TW" /> + <Transliteration unoid="NumToCharLower_zh_TW" /> + <Transliteration unoid="NumToCharUpper_zh_TW" /> + <Transliteration unoid="TextToChuyin_zh_TW" /> + <Transliteration unoid="HALFWIDTH_FULLWIDTH"/> + <Transliteration unoid="FULLWIDTH_HALFWIDTH"/> + <Transliteration unoid="IGNORE_CASE" /> + <Transliteration unoid="IGNORE_WIDTH" /> </LC_TRANSLITERATION> <LC_MISC> <ForbiddenCharacters> diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 2274aa5b714d..280e12dfe4f7 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -170,6 +170,9 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh ) IMPL_CREATEINSTANCE( Transliteration_u2l ) IMPL_CREATEINSTANCE( Transliteration_l2u ) +IMPL_CREATEINSTANCE( Transliteration_sentencecase ) +IMPL_CREATEINSTANCE( Transliteration_titlecase ) +IMPL_CREATEINSTANCE( Transliteration_togglecase ) IMPL_CREATEINSTANCE( Transliteration_caseignore ) IMPL_CREATEINSTANCE( hiraganaToKatakana ) IMPL_CREATEINSTANCE( katakanaToHiragana ) @@ -421,6 +424,15 @@ static const struct InstancesArray { TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE", &Transliteration_l2u_CreateInstance }, { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "SENTENCE_CASE", + &Transliteration_sentencecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "TITLE_CASE", + &Transliteration_titlecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "TOGGLE_CASE", + &Transliteration_togglecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "IGNORE_CASE", &Transliteration_caseignore_CreateInstance }, { TRLT_SERVICELNAME_L10N, diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index a869f6713b99..b58347826470 100644..100755 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -28,7 +28,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_i18npool.hxx" +#include <rtl/ustrbuf.hxx> #include <i18nutil/casefolding.hxx> +#include <i18nutil/unicode.hxx> + +#include <comphelper/processfactory.hxx> +#include <osl/diagnose.h> + + +#include "characterclassificationImpl.hxx" +#include "breakiteratorImpl.hxx" + #define TRANSLITERATION_ALL #include "transliteration_body.hxx" @@ -36,8 +46,11 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::rtl; +#define A2OU(x) OUString::createFromAscii(x) + namespace com { namespace sun { namespace star { namespace i18n { + Transliteration_body::Transliteration_body() { nMappingType = 0; @@ -68,9 +81,35 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString& return ostr; } + +static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar ) +{ + sal_uInt8 nRes = nMappingType; + + // take care of TOGGLE_CASE transliteration: + // nMappingType should not be a combination of flags, thuse we decide now + // which one to use. + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + { + const sal_Int16 nType = unicode::getUnicodeType( cChar ); + if (nType & 0x02 /* lower case*/) + nRes = MappingTypeLowerToUpper; + else + { + OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + nRes = MappingTypeUpperToLower; + } + } + + return nRes; +} + + OUString SAL_CALL -Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset) throw(RuntimeException) +Transliteration_body::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset) + throw(RuntimeException) { #if 0 /* Performance optimization: @@ -139,7 +178,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nOffCount = 0, i; for (i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); nOffCount += map.nmap; } rtl_uString* pStr = x_rtl_uString_new_WithLength( nOffCount, 1 ); // our x_rtl_ustring.h @@ -152,7 +196,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 * pArr = offset.getArray(); for (i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); for (sal_Int32 k = 0; k < map.nmap; k++) { pArr[j] = i + startPos; @@ -184,7 +233,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 j = 0; for ( sal_Int32 i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); for (sal_Int32 k = 0; k < map.nmap; k++) { out[j++] = map.map[k]; @@ -258,4 +312,203 @@ Transliteration_l2u::Transliteration_l2u() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u"; } +Transliteration_togglecase::Transliteration_togglecase() +{ + // usually nMappingType must NOT be a combiantion of different flages here, + // but we take care of that problem in Transliteration_body::transliterate above + // before that value is used. There we will decide which of both is to be used on + // a per character basis. + nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower; + transliterationName = "toggle(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; +} + +Transliteration_titlecase::Transliteration_titlecase() +{ + nMappingType = MappingTypeToTitle; + transliterationName = "title(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; +} + +rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& /*offset*/ ) + throw(RuntimeException) +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + CharacterClassificationImpl aCharClassImpl( xMSF ); + + // possible problem: the locale is not exactly specific for each word in the text... + OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); + return aRes; +} + +Transliteration_sentencecase::Transliteration_sentencecase() +{ + nMappingType = MappingTypeToTitle; // though only to be applied to the first word... + transliterationName = "sentence(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; +} + +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + // inspired from Transliteration_body::transliterate + sal_Int32 nOffCount = 0, i; + bool bPoint = true; + if (useOffset) + { + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + nOffCount++; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + bPoint = false; + } + else if (!bPoint && unicode::isUpper( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); + } + + if(map == 0) + { + nOffCount++; + } + else + { + nOffCount += map->nmap; + } + } + else + { + nOffCount++; + } + } + } + + bPoint = true; + rtl::OUStringBuffer result; + + if (useOffset) + { + result.ensureCapacity(nOffCount); + if ( nOffCount != offset.getLength() ) + offset.realloc( nOffCount ); + } + + + sal_Int32 j = 0; + sal_Int32 * pArr = offset.getArray(); + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + result.append(c); + pArr[j++] = i + startPos; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + else if (!bPoint && unicode::isUpper( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); + } + + if(map == 0) + { + result.append( c ); + pArr[j++] = i + startPos; + } + else + { + for (sal_Int32 k = 0; k < map->nmap; k++) + { + result.append( map->map[k] ); + pArr[j++] = i + startPos; + } + } + bPoint = false; + } + else + { + result.append( c ); + pArr[j++] = i + startPos; + } + } + return result.makeStringAndClear(); +} + +#if 0 +// TL: alternative implemntation try. But breakiterator has its problem too since +// beginOfSentence does not work as expected with '.'. See comment below. +// For the time being I will leave this code here as a from-scratch sample if the +// breakiterator works better at some point... +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount, + Sequence< sal_Int32 >& /*offset*/ ) + throw(RuntimeException) +{ + OUString aRes( inStr.copy( nStartPos, nCount ) ); + + if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0) + { + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + BreakIteratorImpl brk( xMSF ); + + sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; + sal_Int32 nPos = nStartPos + nCount - 1; + while (nPos >= nStartPos && nPos != -1) + { + // possible problem: the locale is not exactly specific for each sentence in the text, + // but it is the only one we have... + nOldSentenceStart = nSentenceStart; + nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale ); + + // since the breakiterator completely ignores '.' characvters as end-of-sentence when + // the next word is lower case we need to take care of that ourself. The drawback: + // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-( + // Well, at least the other product does it in the same way... + sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos ); + nPos = nSentenceStart; + if (nFullStopPos > 0 && nFullStopPos > nSentenceStart) + { + Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD ); + nSentenceStart = aBd2.startPos; + nPos = nFullStopPos; + } + + if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1) + { + // the sentence start might be a quotation mark or some kind of bracket, thus + // we need the first dictionary word starting or following this position + // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD ); + Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true ); + // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) ); + OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) ); + } + else + break; // prevent endless loop + + // continue with previous sentence + if (nPos != -1) + --nPos; + } + } + return aRes; +} +#endif + } } } } diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk index d9b87d19e6ca..57f802be62fe 100644 --- a/i18npool/util/makefile.mk +++ b/i18npool/util/makefile.mk @@ -68,6 +68,7 @@ SHL1LIBS=$(LIB1TARGET) SHL1STDLIBS= \ $(I18NUTILLIB) \ $(I18NISOLANGLIB) \ + $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ diff --git a/instsetoo_native/util/makefile.mk b/instsetoo_native/util/makefile.mk index b2f014f6ad58..28b9c33628c5 100644 --- a/instsetoo_native/util/makefile.mk +++ b/instsetoo_native/util/makefile.mk @@ -279,24 +279,12 @@ openoffice: .ENDIF # "$(alllangiso)"!="" .IF "$(LOCALPYFILES)"!="" -$(foreach,i,$(alllangiso) openoffice_$i{$(PKGFORMAT:^".") .archive} openofficewithjre_$i{$(PKGFORMAT:^".")} openofficedev_$i{$(PKGFORMAT:^".")} broffice_$i{$(PKGFORMAT:^".")} brofficewithjre_$i{$(PKGFORMAT:^".")} brofficedev_$i{$(PKGFORMAT:^".")} sdkoo_$i{$(PKGFORMAT:^".")}) updatepack : $(LOCALPYFILES) $(BIN)$/cp1251.py $(BIN)$/iso8859_1.py +$(foreach,i,$(alllangiso) openoffice_$i{$(PKGFORMAT:^".") .archive} openofficewithjre_$i{$(PKGFORMAT:^".")} openofficedev_$i{$(PKGFORMAT:^".")} broffice_$i{$(PKGFORMAT:^".")} brofficewithjre_$i{$(PKGFORMAT:^".")} brofficedev_$i{$(PKGFORMAT:^".")} sdkoo_$i{$(PKGFORMAT:^".")}) updatepack : $(LOCALPYFILES) .ENDIF # "$(LOCALPYFILES)"!="" $(BIN)$/%.py : $(SOLARSHAREDBIN)$/pyuno$/%.py @$(COPY) $< $@ -.IF "$(SYSTEM_PYTHON)" != "YES" -$(BIN)$/cp1251.py : $(SOLARLIBDIR)$/python$/encodings$/cp1251.py - @$(COPY) $< $@ -$(BIN)$/iso8859_1.py : $(SOLARLIBDIR)$/python$/encodings$/iso8859_1.py - @$(COPY) $< $@ -.ELSE -$(BIN)$/cp1251.py : - @echo "Using system python - nothing more to do here" -$(BIN)$/iso8859_1.py : - @echo "Using system python - nothing more to do here" -.ENDIF - $(BIN)$/intro.zip : $(SOLARCOMMONPCKDIR)$/openoffice_nologo$/intro.zip $(COPY) $< $@ diff --git a/libtextcat/data/new_fingerprints/fpdb.conf b/libtextcat/data/new_fingerprints/fpdb.conf index 5b54fef1d7ad..df56f9e270ef 100644 --- a/libtextcat/data/new_fingerprints/fpdb.conf +++ b/libtextcat/data/new_fingerprints/fpdb.conf @@ -82,3 +82,4 @@ ukrainian.lm uk--utf8 vietnamese.lm vi--utf8 welsh.lm cy--utf8 yiddish_utf.lm yi--utf8 +zulu.lm zu--utf8 diff --git a/libtextcat/data/new_fingerprints/lm/zulu.lm b/libtextcat/data/new_fingerprints/lm/zulu.lm new file mode 100644 index 000000000000..f30c09ced93f --- /dev/null +++ b/libtextcat/data/new_fingerprints/lm/zulu.lm @@ -0,0 +1,400 @@ +_ +a +e +i +n +u +o +l +k +h +s +a_ +b +t +m +g +w +z +e_ +i_ +ng +ku +d +y +la +an +_n +th +le +_u +o_ +el +ba +_k +en +in +wa +p +_e +zi +. +hi +si +al +ha +uk +ab +_i +r +is +ka +_a +kh +we +li +ni +ma +_ng +he +ul +._ +ga +thi +la_ +be +ak +c +on +nd +na +ok +am +lo +ho +, +se +ph +hi_ +ut +es +nga +_ku +,_ +ez +thi_ +un +uth +le_ +uku +hu +f +u_ +um +ek +ne +go +q +_uk +at +aba +_l +sh +lu +M +_uku +ol +_b +hl +ni_ +ngo +kw +- +N +ik +oku +em +nt +as +ge +az +ya +iz +sa +_o +S +uthi +A +za +_w +wa_ +_s +mb +kut +kuth +ela +ye +_y +uthi_ +il +ay +ele +ba_ +I +dl +nge +ath +ub +ke +U +zo +na_ +yi +us +kuthi +esi +ob +v +om +ama +it +lo_ +bu +L +ezi +j +ny +im +ing +li_ +_ab +eni +no +de +ela_ +ze +ang +ko +ala +lw +yo +zin +_U +lel +eng +mi +_ngo +eb +uz +me +gi +ti +ukut +so +ukuth +bo +da +_ba +nz +_aba +the +eli +akh +eni_ +E +ban +s_ +aka +_kw +ma_ +ap +_ukut +he_ +ini +di +K +ka_ +ib +kwa +ulu +ele_ +kho +nj +bi +_z +khu +we_ +lal +enz +ho_ +et +C +gu +zi_ +and +hla +ngi +pha +_um +_ka +isi +_nge +isa +aph +ung +izi +dla +ala_ +zw +nde +to +n_ +ne_ +nk +ke_ +_I +athi +_no +lan +_wa +kul +B +ind +fu +wen +ikh +azi +ule +kub +e. +_S +x +o. +ona +kha +_iz +je +bh +_M +er +kwe +oba +ane +O +_N +sa_ +a. +lwa +_ez +kus +ki +mu +od +" +ebe +P +_nga +hul +_m +ase +ben +_be +T +ic +nda +_si +_na +/ +ant +ngu +ad +anga +nje +ith +a._ +ye_ +athi_ +R +os +alo +tha +za_ +eth +_es +uma +ana +ile +te +ale +aban +: +_A +oba_ +hat +kun +ha_ +phe +be_ +ali +_am +si_ +wo +uy +sik +ise +kan +hath +dlal +_ne +zwe +aw +han +tu +nye +qe +_ko +ah +hel +thu +isa_ +gob +_K +_lo +ta +_ama +ot +ula +_em +ze_ +i. +ngob +_izi +hol +ar +ani +ole +uba +_in +up +eka +ini_ +goba +tho +hon +_ezi +ona_ +ezin +ngoba +lu_ +goba_ +ip +a, +eli_ +t_ +nya +ndl +sha +_is +the_ +i._ +amb diff --git a/libtextcat/libtextcat-2.2.patch b/libtextcat/libtextcat-2.2.patch index 499ff3d4d442..ca7a26cabfbf 100644 --- a/libtextcat/libtextcat-2.2.patch +++ b/libtextcat/libtextcat-2.2.patch @@ -1,5 +1,14 @@ --- misc/libtextcat-2.2/configure Thu May 22 13:39:55 2003 +++ misc/build/libtextcat-2.2/configure Mon Mar 31 11:29:14 2008 +@@ -3451,7 +3451,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu*|k*bsd*-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*) + lt_cv_deplibs_check_method=pass_all ;; @@ -5391,7 +5391,8 @@ allow_undefined_flag= no_undefined_flag= @@ -28,6 +37,15 @@ version_type=freebsd-$objformat case $version_type in freebsd-elf*) +@@ -6365,7 +6365,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu*|k*bsd*-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no --- misc/libtextcat-2.2/src/Makefile.in Thu May 22 13:39:52 2003 +++ misc/build/libtextcat-2.2/src/Makefile.in Mon Mar 31 11:29:14 2008 @@ -124,20 +124,20 @@ @@ -1582,3 +1600,2479 @@ + +/* Define to `unsigned' if <sys/types.h> does not define. */ +/* #undef size_t */ +--- misc/libtextcat-2.2/config.guess 2010-04-15 09:20:04.000000000 +0000 ++++ misc/build/libtextcat-2.2/config.guess 2010-04-15 09:20:41.000000000 +0000 +@@ -1,9 +1,10 @@ + #! /bin/sh + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002 Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ++# Free Software Foundation, Inc. + +-timestamp='2002-10-21' ++timestamp='2009-12-30' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -17,23 +18,25 @@ + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA ++# 02110-1301, USA. + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + +-# Originally written by Per Bothner <per@bothner.com>. +-# Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted ChangeLog entry. ++ ++# Originally written by Per Bothner. Please send patches (context ++# diff format) to <config-patches@gnu.org> and include a ChangeLog ++# entry. + # + # This script attempts to guess a canonical system name similar to + # config.sub. If it succeeds, it prints the system name on stdout, and + # exits with 0. Otherwise, it exits with 1. + # +-# The plan is that this can be called by configure scripts if you +-# don't specify an explicit build system type. ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + + me=`echo "$0" | sed -e 's,.*/,,'` + +@@ -53,8 +56,9 @@ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free ++Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -66,11 +70,11 @@ + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit 0 ;; ++ echo "$timestamp" ; exit ;; + --version | -v ) +- echo "$version" ; exit 0 ;; ++ echo "$version" ; exit ;; + --help | --h* | -h ) +- echo "$usage"; exit 0 ;; ++ echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. +@@ -98,14 +102,18 @@ + # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still + # use `HOST_CC' if defined, but it is deprecated. + +-# This shell variable is my proudest work .. or something. --bje ++# Portable tmp directory creation inspired by the Autoconf team. + +-set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +-(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) +- || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +-dummy=$tmpdir/dummy ; +-files="$dummy.c $dummy.o $dummy.rel $dummy" ; +-trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; ++set_cc_for_build=' ++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; ++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; ++: ${TMPDIR=/tmp} ; ++ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || ++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || ++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || ++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; ++dummy=$tmp/dummy ; ++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; + case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do +@@ -113,15 +121,13 @@ + CC_FOR_BUILD="$c"; break ; + fi ; + done ; +- rm -f $files ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +-esac ; +-unset files' ++esac ; set_cc_for_build= ;' + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. + # (ghazi@noc.rutgers.edu 1994-08-24) +@@ -156,6 +162,7 @@ + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; ++ sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched +@@ -164,7 +171,7 @@ + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ +- | grep __ELF__ >/dev/null ++ | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? +@@ -178,144 +185,128 @@ + ;; + esac + # The OS release +- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ++ # Debian GNU/NetBSD machines have a different userland, and ++ # thus, need a distinct triplet. However, they do not need ++ # kernel version information, so it can be replaced with a ++ # suitable tag, in the style of linux-gnu. ++ case "${UNAME_VERSION}" in ++ Debian*) ++ release='-gnu' ++ ;; ++ *) ++ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ++ ;; ++ esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" +- exit 0 ;; +- amiga:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- arc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- hp300:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mac68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- macppc:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme88k:OpenBSD:*:*) +- echo m88k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvmeppc:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- pmax:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sgi:OpenBSD:*:*) +- echo mipseb-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sun3:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- wgrisc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:OpenBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; ++ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} ++ exit ;; ++ *:ekkoBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} ++ exit ;; ++ *:SolidBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} ++ exit ;; ++ macppc:MirBSD:*:*) ++ echo powerpc-unknown-mirbsd${UNAME_RELEASE} ++ exit ;; ++ *:MirBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} ++ exit ;; + alpha:OSF1:*:*) +- if test $UNAME_RELEASE = "V4.0"; then ++ case $UNAME_RELEASE in ++ *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` +- fi ++ ;; ++ *5.*) ++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ ;; ++ esac ++ # According to Compaq, /usr/sbin/psrinfo has been available on ++ # OSF/1 and Tru64 systems produced since 1995. I hope that ++ # covers most systems running today. This code pipes the CPU ++ # types through head -n 1, so we only detect the type of CPU 0. ++ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` ++ case "$ALPHA_CPU_TYPE" in ++ "EV4 (21064)") ++ UNAME_MACHINE="alpha" ;; ++ "EV4.5 (21064)") ++ UNAME_MACHINE="alpha" ;; ++ "LCA4 (21066/21068)") ++ UNAME_MACHINE="alpha" ;; ++ "EV5 (21164)") ++ UNAME_MACHINE="alphaev5" ;; ++ "EV5.6 (21164A)") ++ UNAME_MACHINE="alphaev56" ;; ++ "EV5.6 (21164PC)") ++ UNAME_MACHINE="alphapca56" ;; ++ "EV5.7 (21164PC)") ++ UNAME_MACHINE="alphapca57" ;; ++ "EV6 (21264)") ++ UNAME_MACHINE="alphaev6" ;; ++ "EV6.7 (21264A)") ++ UNAME_MACHINE="alphaev67" ;; ++ "EV6.8CB (21264C)") ++ UNAME_MACHINE="alphaev68" ;; ++ "EV6.8AL (21264B)") ++ UNAME_MACHINE="alphaev68" ;; ++ "EV6.8CX (21264D)") ++ UNAME_MACHINE="alphaev68" ;; ++ "EV6.9A (21264/EV69A)") ++ UNAME_MACHINE="alphaev69" ;; ++ "EV7 (21364)") ++ UNAME_MACHINE="alphaev7" ;; ++ "EV7.9 (21364A)") ++ UNAME_MACHINE="alphaev79" ;; ++ esac ++ # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. +- eval $set_cc_for_build +- cat <<EOF >$dummy.s +- .data +-\$Lformat: +- .byte 37,100,45,37,120,10,0 # "%d-%x\n" +- +- .text +- .globl main +- .align 4 +- .ent main +-main: +- .frame \$30,16,\$26,0 +- ldgp \$29,0(\$27) +- .prologue 1 +- .long 0x47e03d80 # implver \$0 +- lda \$2,-1 +- .long 0x47e20c21 # amask \$2,\$1 +- lda \$16,\$Lformat +- mov \$0,\$17 +- not \$1,\$18 +- jsr \$26,printf +- ldgp \$29,0(\$26) +- mov 0,\$16 +- jsr \$26,exit +- .end main +-EOF +- $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null +- if test "$?" = 0 ; then +- case `$dummy` in +- 0-0) +- UNAME_MACHINE="alpha" +- ;; +- 1-0) +- UNAME_MACHINE="alphaev5" +- ;; +- 1-1) +- UNAME_MACHINE="alphaev56" +- ;; +- 1-101) +- UNAME_MACHINE="alphapca56" +- ;; +- 2-303) +- UNAME_MACHINE="alphaev6" +- ;; +- 2-307) +- UNAME_MACHINE="alphaev67" +- ;; +- 2-1307) +- UNAME_MACHINE="alphaev68" +- ;; +- 3-1307) +- UNAME_MACHINE="alphaev7" +- ;; +- esac +- fi +- rm -f $dummy.s $dummy && rmdir $tmpdir +- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- exit 0 ;; ++ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` ++ exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix +- exit 0 ;; ++ exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 +- exit 0 ;; ++ exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 +- exit 0;; ++ exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos +- exit 0 ;; ++ exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos +- exit 0 ;; ++ exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition +- exit 0 ;; ++ exit ;; ++ *:z/VM:*:*) ++ echo s390-ibm-zvmoe ++ exit ;; ++ *:OS400:*:*) ++ echo powerpc-ibm-os400 ++ exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} +- exit 0;; ++ exit ;; ++ arm:riscos:*:*|arm:RISCOS:*:*) ++ echo arm-unknown-riscos ++ exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp +- exit 0;; ++ exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then +@@ -323,29 +314,51 @@ + else + echo pyramid-pyramid-bsd + fi +- exit 0 ;; ++ exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 +- exit 0 ;; +- DRS?6000:UNIX_SV:4.2*:7*) ++ exit ;; ++ DRS?6000:unix:4.0:6*) ++ echo sparc-icl-nx6 ++ exit ;; ++ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in +- sparc) echo sparc-icl-nx7 && exit 0 ;; ++ sparc) echo sparc-icl-nx7; exit ;; + esac ;; ++ s390x:SunOS:*:*) ++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; +- i86pc:SunOS:5.*:*) +- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; ++ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) ++ echo i386-pc-auroraux${UNAME_RELEASE} ++ exit ;; ++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) ++ eval $set_cc_for_build ++ SUN_ARCH="i386" ++ # If there is a compiler, see if it is configured for 64-bit objects. ++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. ++ # This test works for both compilers. ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ SUN_ARCH="x86_64" ++ fi ++ fi ++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) +@@ -354,10 +367,10 @@ + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` +- exit 0 ;; ++ exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 +@@ -369,10 +382,10 @@ + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac +- exit 0 ;; ++ exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor +@@ -383,37 +396,40 @@ + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ m68k:machten:*:*) ++ echo m68k-apple-machten${UNAME_RELEASE} ++ exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 +- exit 0 ;; ++ exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +@@ -437,33 +453,33 @@ + exit (-1); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c \ +- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ +- && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +- rm -f $dummy.c $dummy && rmdir $tmpdir ++ $CC_FOR_BUILD -o $dummy $dummy.c && ++ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && ++ SYSTEM_NAME=`$dummy $dummyarg` && ++ { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax +- exit 0 ;; ++ exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax +- exit 0 ;; +- Night_Hawk:*:*:PowerMAX_OS) ++ exit ;; ++ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax +- exit 0 ;; ++ exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix +- exit 0 ;; ++ exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 +- exit 0 ;; ++ exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 +- exit 0 ;; ++ exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 +- exit 0 ;; ++ exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` +@@ -479,29 +495,29 @@ + else + echo i586-dg-dgux${UNAME_RELEASE} + fi +- exit 0 ;; ++ exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 +- exit 0 ;; ++ exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 +- exit 0 ;; ++ exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 +- exit 0 ;; ++ exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd +- exit 0 ;; ++ exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` +- exit 0 ;; ++ exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. +- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id +- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' ++ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id ++ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix +- exit 0 ;; ++ exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` +@@ -509,7 +525,7 @@ + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} +- exit 0 ;; ++ exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build +@@ -524,16 +540,19 @@ + exit(0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +- rm -f $dummy.c $dummy && rmdir $tmpdir +- echo rs6000-ibm-aix3.2.5 ++ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` ++ then ++ echo "$SYSTEM_NAME" ++ else ++ echo rs6000-ibm-aix3.2.5 ++ fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi +- exit 0 ;; +- *:AIX:*:[45]) ++ exit ;; ++ *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 +@@ -546,28 +565,28 @@ + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} +- exit 0 ;; ++ exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix +- exit 0 ;; ++ exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 +- exit 0 ;; ++ exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to +- exit 0 ;; # report: romp-ibm BSD 4.3 ++ exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx +- exit 0 ;; ++ exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 +- exit 0 ;; ++ exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd +- exit 0 ;; ++ exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 +- exit 0 ;; ++ exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in +@@ -624,16 +643,36 @@ + } + EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` +- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi +- rm -f $dummy.c $dummy && rmdir $tmpdir ++ test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac ++ if [ ${HP_ARCH} = "hppa2.0w" ] ++ then ++ eval $set_cc_for_build ++ ++ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating ++ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler ++ # generating 64-bit code. GNU and HP use different nomenclature: ++ # ++ # $ CC_FOR_BUILD=cc ./config.guess ++ # => hppa2.0w-hp-hpux11.23 ++ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess ++ # => hppa64-hp-hpux11.23 ++ ++ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | ++ grep -q __LP64__ ++ then ++ HP_ARCH="hppa2.0w" ++ else ++ HP_ARCH="hppa64" ++ fi ++ fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} +- exit 0 ;; ++ exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} +- exit 0 ;; ++ exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +@@ -661,186 +700,248 @@ + exit (0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +- rm -f $dummy.c $dummy && rmdir $tmpdir ++ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && ++ { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 +- exit 0 ;; ++ exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd +- exit 0 ;; ++ exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd +- exit 0 ;; ++ exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix +- exit 0 ;; ++ exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf +- exit 0 ;; ++ exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf +- exit 0 ;; ++ exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi +- exit 0 ;; ++ exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites +- exit 0 ;; ++ exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd +- exit 0 ;; ++ exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit 0 ;; ++ exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd +- exit 0 ;; ++ exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd +- exit 0 ;; ++ exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd +- exit 0 ;; ++ exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; +- CRAY*T3D:*:*:*) +- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; ++ *:UNICOS/mp:*:*) ++ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit 0 ;; ++ exit ;; ++ 5000:UNIX_System_V:4.*:*) ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` ++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:FreeBSD:*:*) +- # Determine whether the default compiler uses glibc. +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include <features.h> +- #if __GLIBC__ >= 2 +- LIBC=gnu +- #else +- LIBC= +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +- rm -f $dummy.c && rmdir $tmpdir +- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} +- exit 0 ;; ++ case ${UNAME_MACHINE} in ++ pc98) ++ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ amd64) ++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ *) ++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ esac ++ exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin +- exit 0 ;; +- i*:MINGW*:*) ++ exit ;; ++ *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 +- exit 0 ;; ++ exit ;; ++ i*:windows32*:*) ++ # uname -m includes "-pc" on this system. ++ echo ${UNAME_MACHINE}-mingw32 ++ exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 +- exit 0 ;; +- x86:Interix*:3*) +- echo i386-pc-interix3 +- exit 0 ;; ++ exit ;; ++ *:Interix*:*) ++ case ${UNAME_MACHINE} in ++ x86) ++ echo i586-pc-interix${UNAME_RELEASE} ++ exit ;; ++ authenticamd | genuineintel | EM64T) ++ echo x86_64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ IA64) ++ echo ia64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ esac ;; ++ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) ++ echo i${UNAME_MACHINE}-pc-mks ++ exit ;; ++ 8664:Windows_NT:*) ++ echo x86_64-pc-mks ++ exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? +- echo i386-pc-interix +- exit 0 ;; ++ echo i586-pc-interix ++ exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin +- exit 0 ;; ++ exit ;; ++ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) ++ echo x86_64-unknown-cygwin ++ exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin +- exit 0 ;; ++ exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + *:GNU:*:*) ++ # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` +- exit 0 ;; ++ exit ;; ++ *:GNU/*:*:*) ++ # other systems with GNU libc and userland ++ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu ++ exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix +- exit 0 ;; ++ exit ;; ++ alpha:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ EV5) UNAME_MACHINE=alphaev5 ;; ++ EV56) UNAME_MACHINE=alphaev56 ;; ++ PCA56) UNAME_MACHINE=alphapca56 ;; ++ PCA57) UNAME_MACHINE=alphapca56 ;; ++ EV6) UNAME_MACHINE=alphaev6 ;; ++ EV67) UNAME_MACHINE=alphaev67 ;; ++ EV68*) UNAME_MACHINE=alphaev68 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi ++ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ++ exit ;; + arm*:Linux:*:*) ++ eval $set_cc_for_build ++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_EABI__ ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ else ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi ++ fi ++ exit ;; ++ avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ cris:Linux:*:*) ++ echo cris-axis-linux-gnu ++ exit ;; ++ crisv32:Linux:*:*) ++ echo crisv32-axis-linux-gnu ++ exit ;; ++ frv:Linux:*:*) ++ echo frv-unknown-linux-gnu ++ exit ;; ++ i*86:Linux:*:*) ++ LIBC=gnu ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #ifdef __dietlibc__ ++ LIBC=dietlibc ++ #endif ++EOF ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}" ++ exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ m32r*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; +- mips:Linux:*:*) ++ exit ;; ++ mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU +- #undef mips +- #undef mipsel ++ #undef ${UNAME_MACHINE} ++ #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mipsel ++ CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips ++ CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif + EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +- rm -f $dummy.c && rmdir $tmpdir +- test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` ++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; +- ppc:Linux:*:*) +- echo powerpc-unknown-linux-gnu +- exit 0 ;; +- ppc64:Linux:*:*) +- echo powerpc64-unknown-linux-gnu +- exit 0 ;; +- alpha:Linux:*:*) +- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in +- EV5) UNAME_MACHINE=alphaev5 ;; +- EV56) UNAME_MACHINE=alphaev56 ;; +- PCA56) UNAME_MACHINE=alphapca56 ;; +- PCA57) UNAME_MACHINE=alphapca56 ;; +- EV6) UNAME_MACHINE=alphaev6 ;; +- EV67) UNAME_MACHINE=alphaev67 ;; +- EV68*) UNAME_MACHINE=alphaev68 ;; +- esac +- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null +- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi +- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} +- exit 0 ;; ++ or32:Linux:*:*) ++ echo or32-unknown-linux-gnu ++ exit ;; ++ padre:Linux:*:*) ++ echo sparc-unknown-linux-gnu ++ exit ;; ++ parisc64:Linux:*:* | hppa64:Linux:*:*) ++ echo hppa64-unknown-linux-gnu ++ exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in +@@ -848,82 +949,40 @@ + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac +- exit 0 ;; +- parisc64:Linux:*:* | hppa64:Linux:*:*) +- echo hppa64-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ ppc64:Linux:*:*) ++ echo powerpc64-unknown-linux-gnu ++ exit ;; ++ ppc:Linux:*:*) ++ echo powerpc-unknown-linux-gnu ++ exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux +- exit 0 ;; ++ exit ;; ++ sh64*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ vax:Linux:*:*) ++ echo ${UNAME_MACHINE}-dec-linux-gnu ++ exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu +- exit 0 ;; +- i*86:Linux:*:*) +- # The BFD linker knows what the default object file format is, so +- # first see if it will tell us. cd to the root directory to prevent +- # problems with other programs or directories called `ld' in the path. +- # Set LC_ALL=C to ensure ld outputs messages in English. +- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ +- | sed -ne '/supported targets:/!d +- s/[ ][ ]*/ /g +- s/.*supported targets: *// +- s/ .*// +- p'` +- case "$ld_supported_targets" in +- elf32-i386) +- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" +- ;; +- a.out-i386-linux) +- echo "${UNAME_MACHINE}-pc-linux-gnuaout" +- exit 0 ;; +- coff-i386) +- echo "${UNAME_MACHINE}-pc-linux-gnucoff" +- exit 0 ;; +- "") +- # Either a pre-BFD a.out linker (linux-gnuoldld) or +- # one that does not give us useful --help. +- echo "${UNAME_MACHINE}-pc-linux-gnuoldld" +- exit 0 ;; +- esac +- # Determine whether the default compiler is a.out or elf +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include <features.h> +- #ifdef __ELF__ +- # ifdef __GLIBC__ +- # if __GLIBC__ >= 2 +- LIBC=gnu +- # else +- LIBC=gnulibc1 +- # endif +- # else +- LIBC=gnulibc1 +- # endif +- #else +- #ifdef __INTEL_COMPILER +- LIBC=gnu +- #else +- LIBC=gnuaout +- #endif +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +- rm -f $dummy.c && rmdir $tmpdir +- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 +- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 +- ;; ++ exit ;; ++ xtensa*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 +- exit 0 ;; ++ exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... +@@ -931,7 +990,27 @@ + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} +- exit 0 ;; ++ exit ;; ++ i*86:OS/2:*:*) ++ # If we were able to find `uname', then EMX Unix compatibility ++ # is probably installed. ++ echo ${UNAME_MACHINE}-pc-os2-emx ++ exit ;; ++ i*86:XTS-300:*:STOP) ++ echo ${UNAME_MACHINE}-unknown-stop ++ exit ;; ++ i*86:atheos:*:*) ++ echo ${UNAME_MACHINE}-unknown-atheos ++ exit ;; ++ i*86:syllable:*:*) ++ echo ${UNAME_MACHINE}-pc-syllable ++ exit ;; ++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) ++ echo i386-unknown-lynxos${UNAME_RELEASE} ++ exit ;; ++ i*86:*DOS:*:*) ++ echo ${UNAME_MACHINE}-pc-msdosdjgpp ++ exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then +@@ -939,15 +1018,16 @@ + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi +- exit 0 ;; +- i*86:*:5:[78]*) ++ exit ;; ++ i*86:*:5:[678]*) ++ # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} +- exit 0 ;; ++ exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` +@@ -965,76 +1045,86 @@ + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi +- exit 0 ;; +- i*86:*DOS:*:*) +- echo ${UNAME_MACHINE}-pc-msdosdjgpp +- exit 0 ;; ++ exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about +- # the processor, so we play safe by assuming i386. +- echo i386-pc-msdosdjgpp +- exit 0 ;; ++ # the processor, so we play safe by assuming i586. ++ # Note: whatever this is, it MUST be the same as what config.sub ++ # prints for the "djgpp" host, or else GDB configury will decide that ++ # this is a cross-build. ++ echo i586-pc-msdosdjgpp ++ exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 +- exit 0 ;; ++ exit ;; + paragon:*:*:*) + echo i860-intel-osf1 +- exit 0 ;; ++ exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi +- exit 0 ;; ++ exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv +- exit 0 ;; ++ exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv +- exit 0 ;; +- M68*:*:R3V[567]*:*) +- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; +- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) ++ exit ;; ++ M680?0:D-NIX:5.3:*) ++ echo m68k-diab-dnix ++ exit ;; ++ M68*:*:R3V[5678]*:*) ++ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; ++ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && echo i486-ncr-sysv4.3${OS_REL} && exit 0 ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ +- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && echo i486-ncr-sysv4 && exit 0 ;; ++ && { echo i486-ncr-sysv4; exit; } ;; ++ NCR*:*:4.2:* | MPRAS*:*:4.2:*) ++ OS_REL='.3' ++ test -r /etc/.relid \ ++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 +- exit 0 ;; +- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) +- echo i386-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; +- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) ++ exit ;; ++ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 +- exit 0 ;; ++ exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 +- exit 0 ;; ++ exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` +@@ -1042,64 +1132,94 @@ + else + echo ns32k-sni-sysv + fi +- exit 0 ;; ++ exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 +- exit 0 ;; ++ exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 +- exit 0 ;; ++ exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 +- exit 0 ;; ++ exit ;; ++ i*86:VOS:*:*) ++ # From Paul.Green@stratus.com. ++ echo ${UNAME_MACHINE}-stratus-vos ++ exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos +- exit 0 ;; ++ exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 +- exit 0 ;; ++ exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi +- exit 0 ;; ++ exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos +- exit 0 ;; ++ exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos +- exit 0 ;; ++ exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos +- exit 0 ;; ++ exit ;; ++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. ++ echo i586-pc-haiku ++ exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ SX-7:SUPER-UX:*:*) ++ echo sx7-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8:SUPER-UX:*:*) ++ echo sx8-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8R:SUPER-UX:*:*) ++ echo sx8r-nec-superux${UNAME_RELEASE} ++ exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Darwin:*:*) +- echo `uname -p`-apple-darwin${UNAME_RELEASE} +- exit 0 ;; ++ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown ++ case $UNAME_PROCESSOR in ++ i386) ++ eval $set_cc_for_build ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ UNAME_PROCESSOR="x86_64" ++ fi ++ fi ;; ++ unknown) UNAME_PROCESSOR=powerpc ;; ++ esac ++ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} ++ exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then +@@ -1107,22 +1227,25 @@ + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:QNX:*:4*) + echo i386-pc-qnx +- exit 0 ;; +- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) ++ exit ;; ++ NSE-?:NONSTOP_KERNEL:*:*) ++ echo nse-tandem-nsk${UNAME_RELEASE} ++ exit ;; ++ NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux +- exit 0 ;; ++ exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv +- exit 0 ;; ++ exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 +@@ -1133,36 +1256,50 @@ + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 +- exit 0 ;; +- i*86:OS/2:*:*) +- # If we were able to find `uname', then EMX Unix compatibility +- # is probably installed. +- echo ${UNAME_MACHINE}-pc-os2-emx +- exit 0 ;; ++ exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 +- exit 0 ;; ++ exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex +- exit 0 ;; ++ exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 +- exit 0 ;; ++ exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 +- exit 0 ;; ++ exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 +- exit 0 ;; ++ exit ;; + *:ITS:*:*) + echo pdp10-unknown-its +- exit 0 ;; +- i*86:XTS-300:*:STOP) +- echo ${UNAME_MACHINE}-unknown-stop +- exit 0 ;; +- i*86:atheos:*:*) +- echo ${UNAME_MACHINE}-unknown-atheos +- exit 0 ;; ++ exit ;; ++ SEI:*:*:SEIUX) ++ echo mips-sei-seiux${UNAME_RELEASE} ++ exit ;; ++ *:DragonFly:*:*) ++ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ++ exit ;; ++ *:*VMS:*:*) ++ UNAME_MACHINE=`(uname -p) 2>/dev/null` ++ case "${UNAME_MACHINE}" in ++ A*) echo alpha-dec-vms ; exit ;; ++ I*) echo ia64-dec-vms ; exit ;; ++ V*) echo vax-dec-vms ; exit ;; ++ esac ;; ++ *:XENIX:*:SysV) ++ echo i386-pc-xenix ++ exit ;; ++ i*86:skyos:*:*) ++ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' ++ exit ;; ++ i*86:rdos:*:*) ++ echo ${UNAME_MACHINE}-pc-rdos ++ exit ;; ++ i*86:AROS:*:*) ++ echo ${UNAME_MACHINE}-pc-aros ++ exit ;; + esac + + #echo '(No uname command or uname output not recognized.)' 1>&2 +@@ -1194,7 +1331,7 @@ + #endif + + #if defined (__arm) && defined (__acorn) && defined (__unix) +- printf ("arm-acorn-riscix"); exit (0); ++ printf ("arm-acorn-riscix\n"); exit (0); + #endif + + #if defined (hp300) && !defined (hpux) +@@ -1283,12 +1420,12 @@ + } + EOF + +-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +-rm -f $dummy.c $dummy && rmdir $tmpdir ++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && ++ { echo "$SYSTEM_NAME"; exit; } + + # Apollos put the system type in the environment. + +-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } ++test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + + # Convex versions that predate uname can use getsysinfo(1) + +@@ -1297,22 +1434,22 @@ + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd +- exit 0 ;; ++ exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit 0 ;; ++ exit ;; + c34*) + echo c34-convex-bsd +- exit 0 ;; ++ exit ;; + c38*) + echo c38-convex-bsd +- exit 0 ;; ++ exit ;; + c4*) + echo c4-convex-bsd +- exit 0 ;; ++ exit ;; + esac + fi + +@@ -1323,7 +1460,9 @@ + the operating system you are using. It is advised that you + download the most up to date version of the config scripts from + +- ftp://ftp.gnu.org/pub/gnu/config/ ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD ++and ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + + If the version you run ($0) is already up to date, please + send the following data and any information you think might be +--- misc/libtextcat-2.2/config.sub 2010-04-15 09:20:04.000000000 +0000 ++++ misc/build/libtextcat-2.2/config.sub 2010-04-15 09:20:41.000000000 +0000 +@@ -1,9 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002 Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ++# Free Software Foundation, Inc. + +-timestamp='2002-09-05' ++timestamp='2010-01-22' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -21,22 +22,26 @@ + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, +-# Boston, MA 02111-1307, USA. +- ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA ++# 02110-1301, USA. ++# + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + ++ + # Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted ChangeLog entry. ++# diff and a properly formatted GNU ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD ++ + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -70,8 +75,9 @@ + version="\ + GNU config.sub ($timestamp) + +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free ++Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -83,11 +89,11 @@ + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit 0 ;; ++ echo "$timestamp" ; exit ;; + --version | -v ) +- echo "$version" ; exit 0 ;; ++ echo "$version" ; exit ;; + --help | --h* | -h ) +- echo "$usage"; exit 0 ;; ++ echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. +@@ -99,7 +105,7 @@ + *local*) + # First pass through any local machine types. + echo $1 +- exit 0;; ++ exit ;; + + * ) + break ;; +@@ -118,7 +124,10 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) ++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ ++ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ ++ kopensolaris*-gnu* | \ ++ storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -144,10 +153,13 @@ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis) ++ -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; ++ -bluegene*) ++ os=-cnk ++ ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -169,6 +181,10 @@ + -hiux*) + os=-hiuxwe2 + ;; ++ -sco6) ++ os=-sco5v6 ++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ++ ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +@@ -185,6 +201,10 @@ + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -sco5v6*) ++ # Don't forget version if it is 3.2v4 or newer. ++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ++ ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +@@ -228,51 +248,71 @@ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ +- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ +- | clipper \ ++ | am33_2.0 \ ++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ ++ | bfin \ ++ | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ +- | fr30 | frv \ ++ | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ +- | ip2k \ +- | m32r | m68000 | m68k | m88k | mcore \ ++ | ip2k | iq2000 \ ++ | lm32 \ ++ | m32c | m32r | m32rle | m68000 | m68k | m88k \ ++ | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ +- | mips64vr | mips64vrel \ ++ | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ ++ | mips64r5900 | mips64r5900el \ ++ | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ ++ | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ ++ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ ++ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ ++ | moxie \ ++ | mt \ ++ | msp430 \ ++ | nios | nios2 \ + | ns16k | ns32k \ +- | openrisc | or32 \ ++ | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ +- | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ ++ | rx \ ++ | score \ ++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ +- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ +- | strongarm \ +- | tahoe | thumb | tic80 | tron \ ++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ ++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ ++ | spu | strongarm \ ++ | tahoe | thumb | tic4x | tic80 | tron \ ++ | ubicom32 \ + | v850 | v850e \ + | we32k \ +- | x86 | xscale | xstormy16 | xtensa \ +- | z8k) ++ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ ++ | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12) ++ m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; ++ ms1) ++ basic_machine=mt-unknown ++ ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and +@@ -292,50 +332,69 @@ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ +- | avr-* \ +- | bs2000-* \ +- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ +- | clipper-* | cydra-* \ ++ | avr-* | avr32-* \ ++ | bfin-* | bs2000-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ ++ | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ +- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ +- | ip2k-* \ +- | m32r-* \ ++ | ip2k-* | iq2000-* \ ++ | lm32-* \ ++ | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | mcore-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +- | mips64vr-* | mips64vrel-* \ ++ | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ ++ | mips64r5900-* | mips64r5900el-* \ ++ | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ ++ | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ ++ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ ++ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ +- | mipstx39 | mipstx39el \ ++ | mipstx39-* | mipstx39el-* \ ++ | mmix-* \ ++ | mt-* \ ++ | msp430-* \ ++ | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ +- | romp-* | rs6000-* \ +- | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ ++ | romp-* | rs6000-* | rx-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ +- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ +- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ +- | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ ++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ ++ | sparclite-* \ ++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ ++ | tahoe-* | thumb-* \ ++ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tile-* | tilegx-* \ ++ | tron-* \ ++ | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ +- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ +- | xtensa-* \ ++ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ ++ | xstormy16-* | xtensa*-* \ + | ymp-* \ +- | z8k-*) ++ | z8k-* | z80-*) ++ ;; ++ # Recognize the basic CPU types without company name, with glob match. ++ xtensa*) ++ basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +@@ -353,6 +412,9 @@ + basic_machine=a29k-amd + os=-udi + ;; ++ abacus) ++ basic_machine=abacus-unknown ++ ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout +@@ -367,6 +429,12 @@ + basic_machine=a29k-none + os=-bsd + ;; ++ amd64) ++ basic_machine=x86_64-pc ++ ;; ++ amd64-*) ++ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + amdahl) + basic_machine=580-amdahl + os=-sysv +@@ -390,6 +458,10 @@ + basic_machine=m68k-apollo + os=-bsd + ;; ++ aros) ++ basic_machine=i386-pc ++ os=-aros ++ ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -398,10 +470,26 @@ + basic_machine=ns32k-sequent + os=-dynix + ;; ++ blackfin) ++ basic_machine=bfin-unknown ++ os=-linux ++ ;; ++ blackfin-*) ++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; ++ bluegene*) ++ basic_machine=powerpc-ibm ++ os=-cnk ++ ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; ++ cegcc) ++ basic_machine=arm-unknown ++ os=-cegcc ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -426,12 +514,27 @@ + basic_machine=j90-cray + os=-unicos + ;; ++ craynv) ++ basic_machine=craynv-cray ++ os=-unicosmp ++ ;; ++ cr16) ++ basic_machine=cr16-unknown ++ os=-elf ++ ;; + crds | unos) + basic_machine=m68k-crds + ;; ++ crisv32 | crisv32-* | etraxfs*) ++ basic_machine=crisv32-axis ++ ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; ++ crx) ++ basic_machine=crx-unknown ++ os=-elf ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; +@@ -454,6 +557,14 @@ + basic_machine=m88k-motorola + os=-sysv3 + ;; ++ dicos) ++ basic_machine=i686-pc ++ os=-dicos ++ ;; ++ djgpp) ++ basic_machine=i586-pc ++ os=-msdosdjgpp ++ ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx +@@ -604,6 +715,14 @@ + basic_machine=m68k-isi + os=-sysv + ;; ++ m68knommu) ++ basic_machine=m68k-unknown ++ os=-linux ++ ;; ++ m68knommu-*) ++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + m88k-omron*) + basic_machine=m88k-omron + ;; +@@ -615,10 +734,17 @@ + basic_machine=ns32k-utek + os=-sysv + ;; ++ microblaze) ++ basic_machine=microblaze-xilinx ++ ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; ++ mingw32ce) ++ basic_machine=arm-unknown ++ os=-mingw32ce ++ ;; + miniframe) + basic_machine=m68000-convergent + ;; +@@ -632,10 +758,6 @@ + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; +- mmix*) +- basic_machine=mmix-knuth +- os=-mmixware +- ;; + monitor) + basic_machine=m68k-rom68k + os=-coff +@@ -648,6 +770,9 @@ + basic_machine=i386-pc + os=-msdos + ;; ++ ms1-*) ++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ++ ;; + mvs) + basic_machine=i370-ibm + os=-mvs +@@ -723,9 +848,12 @@ + basic_machine=hppa1.1-oki + os=-proelf + ;; +- or32 | or32-*) ++ openrisc | openrisc-*) + basic_machine=or32-unknown +- os=-coff ++ ;; ++ os400) ++ basic_machine=powerpc-ibm ++ os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson +@@ -743,6 +871,14 @@ + basic_machine=i860-intel + os=-osf + ;; ++ parisc) ++ basic_machine=hppa-unknown ++ os=-linux ++ ;; ++ parisc-*) ++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + pbd) + basic_machine=sparc-tti + ;; +@@ -752,24 +888,36 @@ + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; ++ pc98) ++ basic_machine=i386-pc ++ ;; ++ pc98-*) ++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; +- pentiumii | pentium2) ++ pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; ++ pentium4) ++ basic_machine=i786-pc ++ ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; +- pentiumii-* | pentium2-*) ++ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ++ pentium4-*) ++ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + pn) + basic_machine=pn-gould + ;; +@@ -802,6 +950,10 @@ + basic_machine=i586-unknown + os=-pw32 + ;; ++ rdos) ++ basic_machine=i386-pc ++ os=-rdos ++ ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff +@@ -828,6 +980,14 @@ + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; ++ sde) ++ basic_machine=mipsisa32-sde ++ os=-elf ++ ;; ++ sei) ++ basic_machine=mips-sei ++ os=-seiux ++ ;; + sequent) + basic_machine=i386-sequent + ;; +@@ -835,6 +995,12 @@ + basic_machine=sh-hitachi + os=-hms + ;; ++ sh5el) ++ basic_machine=sh5le-unknown ++ ;; ++ sh64) ++ basic_machine=sh64-unknown ++ ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks +@@ -901,10 +1067,6 @@ + basic_machine=i386-sequent + os=-dynix + ;; +- t3d) +- basic_machine=alpha-cray +- os=-unicos +- ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos +@@ -913,14 +1075,27 @@ + basic_machine=t90-cray + os=-unicos + ;; +- tic4x | c4x*) +- basic_machine=tic4x-unknown +- os=-coff +- ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; ++ tic55x | c55x*) ++ basic_machine=tic55x-unknown ++ os=-coff ++ ;; ++ tic6x | c6x*) ++ basic_machine=tic6x-unknown ++ os=-coff ++ ;; ++ # This must be matched before tile*. ++ tilegx*) ++ basic_machine=tilegx-unknown ++ os=-linux-gnu ++ ;; ++ tile*) ++ basic_machine=tile-unknown ++ os=-linux-gnu ++ ;; + tx39) + basic_machine=mipstx39-unknown + ;; +@@ -934,6 +1109,10 @@ + tower | tower-32) + basic_machine=m68k-ncr + ;; ++ tpf) ++ basic_machine=s390x-ibm ++ os=-tpf ++ ;; + udi29k) + basic_machine=a29k-amd + os=-udi +@@ -977,9 +1156,9 @@ + basic_machine=hppa1.1-winbond + os=-proelf + ;; +- windows32) +- basic_machine=i386-pc +- os=-windows32-msvcrt ++ xbox) ++ basic_machine=i686-pc ++ os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell +@@ -992,6 +1171,10 @@ + basic_machine=z8k-unknown + os=-sim + ;; ++ z80-*-coff) ++ basic_machine=z80-unknown ++ os=-sim ++ ;; + none) + basic_machine=none-none + os=-none +@@ -1011,6 +1194,9 @@ + romp) + basic_machine=romp-ibm + ;; ++ mmix) ++ basic_machine=mmix-knuth ++ ;; + rs6000) + basic_machine=rs6000-ibm + ;; +@@ -1027,13 +1213,10 @@ + we32k) + basic_machine=we32k-att + ;; +- sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) ++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; +- sh64) +- basic_machine=sh64-unknown +- ;; +- sparc | sparcv9 | sparcv9b) ++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) +@@ -1080,6 +1263,9 @@ + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. ++ -auroraux) ++ os=-auroraux ++ ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1100,24 +1286,30 @@ + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ ++ | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* \ ++ | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ +- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ +- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ ++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ ++ | -openbsd* | -solidbsd* \ ++ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ ++ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +- | -chorusos* | -chorusrdb* \ ++ | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ +- | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ ++ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ +- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) ++ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ ++ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1129,16 +1321,21 @@ + ;; + esac + ;; ++ -nto-qnx*) ++ ;; + -nto*) +- os=-nto-qnx ++ os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ +- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ ++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; ++ -linux-dietlibc) ++ os=-linux-dietlibc ++ ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; +@@ -1151,6 +1348,9 @@ + -opened*) + os=-openedition + ;; ++ -os400*) ++ os=-os400 ++ ;; + -wince*) + os=-wince + ;; +@@ -1172,6 +1372,9 @@ + -atheos*) + os=-atheos + ;; ++ -syllable*) ++ os=-syllable ++ ;; + -386bsd) + os=-bsd + ;; +@@ -1194,6 +1397,9 @@ + -sinix*) + os=-sysv4 + ;; ++ -tpf*) ++ os=-tpf ++ ;; + -triton*) + os=-sysv3 + ;; +@@ -1224,6 +1430,20 @@ + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; ++ -aros*) ++ os=-aros ++ ;; ++ -kaos*) ++ os=-kaos ++ ;; ++ -zvmoe) ++ os=-zvmoe ++ ;; ++ -dicos*) ++ os=-dicos ++ ;; ++ -nacl*) ++ ;; + -none) + ;; + *) +@@ -1246,6 +1466,12 @@ + # system, and we'll never get to this point. + + case $basic_machine in ++ score-*) ++ os=-elf ++ ;; ++ spu-*) ++ os=-elf ++ ;; + *-acorn) + os=-riscix1.2 + ;; +@@ -1255,6 +1481,9 @@ + arm*-semi) + os=-aout + ;; ++ c4x-* | tic4x-*) ++ os=-coff ++ ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 +@@ -1280,6 +1509,9 @@ + m68*-cisco) + os=-aout + ;; ++ mep-*) ++ os=-elf ++ ;; + mips*-cisco) + os=-elf + ;; +@@ -1298,9 +1530,15 @@ + *-be) + os=-beos + ;; ++ *-haiku) ++ os=-haiku ++ ;; + *-ibm) + os=-aix + ;; ++ *-knuth) ++ os=-mmixware ++ ;; + *-wec) + os=-proelf + ;; +@@ -1403,7 +1641,7 @@ + -sunos*) + vendor=sun + ;; +- -aix*) ++ -cnk*|-aix*) + vendor=ibm + ;; + -beos*) +@@ -1433,9 +1671,15 @@ + -mvs* | -opened*) + vendor=ibm + ;; ++ -os400*) ++ vendor=ibm ++ ;; + -ptx*) + vendor=sequent + ;; ++ -tpf*) ++ vendor=ibm ++ ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; +@@ -1460,7 +1704,7 @@ + esac + + echo $basic_machine$os +-exit 0 ++exit + + # Local variables: + # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/libxmlsec/xmlsec1-update-config-sub-and-guess.patch b/libxmlsec/xmlsec1-update-config-sub-and-guess.patch new file mode 100644 index 000000000000..a0caf352c99b --- /dev/null +++ b/libxmlsec/xmlsec1-update-config-sub-and-guess.patch @@ -0,0 +1,2314 @@ +--- misc/xmlsec1-1.2.12/config.guess 2010-04-15 09:29:35.000000000 +0000 ++++ misc/build/xmlsec1-1.2.12/config.guess 2010-04-15 09:29:46.000000000 +0000 +@@ -1,9 +1,10 @@ + #! /bin/sh + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ++# Free Software Foundation, Inc. + +-timestamp='2003-06-17' ++timestamp='2009-12-30' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -17,23 +18,25 @@ + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA ++# 02110-1301, USA. + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + +-# Originally written by Per Bothner <per@bothner.com>. +-# Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted ChangeLog entry. ++ ++# Originally written by Per Bothner. Please send patches (context ++# diff format) to <config-patches@gnu.org> and include a ChangeLog ++# entry. + # + # This script attempts to guess a canonical system name similar to + # config.sub. If it succeeds, it prints the system name on stdout, and + # exits with 0. Otherwise, it exits with 1. + # +-# The plan is that this can be called by configure scripts if you +-# don't specify an explicit build system type. ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + + me=`echo "$0" | sed -e 's,.*/,,'` + +@@ -53,8 +56,9 @@ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free ++Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -66,11 +70,11 @@ + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit 0 ;; ++ echo "$timestamp" ; exit ;; + --version | -v ) +- echo "$version" ; exit 0 ;; ++ echo "$version" ; exit ;; + --help | --h* | -h ) +- echo "$usage"; exit 0 ;; ++ echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. +@@ -104,7 +108,7 @@ + trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; + trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; + : ${TMPDIR=/tmp} ; +- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || ++ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +@@ -123,7 +127,7 @@ + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +-esac ;' ++esac ; set_cc_for_build= ;' + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. + # (ghazi@noc.rutgers.edu 1994-08-24) +@@ -136,13 +140,6 @@ + UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown + UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +-## for Red Hat Linux +-if test -f /etc/redhat-release ; then +- VENDOR=redhat ; +-else +- VENDOR= ; +-fi +- + # Note: order is significant - the case branches are not exclusive. + + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +@@ -165,6 +162,7 @@ + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; ++ sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched +@@ -173,7 +171,7 @@ + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ +- | grep __ELF__ >/dev/null ++ | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? +@@ -203,50 +201,32 @@ + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" +- exit 0 ;; +- amiga:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- arc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- hp300:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mac68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- macppc:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme88k:OpenBSD:*:*) +- echo m88k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvmeppc:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- pmax:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sgi:OpenBSD:*:*) +- echo mipseb-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sun3:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- wgrisc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:OpenBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; ++ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} ++ exit ;; ++ *:ekkoBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} ++ exit ;; ++ *:SolidBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} ++ exit ;; ++ macppc:MirBSD:*:*) ++ echo powerpc-unknown-mirbsd${UNAME_RELEASE} ++ exit ;; ++ *:MirBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} ++ exit ;; + alpha:OSF1:*:*) +- if test $UNAME_RELEASE = "V4.0"; then ++ case $UNAME_RELEASE in ++ *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` +- fi ++ ;; ++ *5.*) ++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ ;; ++ esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU +@@ -284,42 +264,49 @@ + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac ++ # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. +- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- exit 0 ;; +- Alpha*:OpenVMS:*:*) +- echo alpha-hp-vms +- exit 0 ;; ++ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` ++ exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix +- exit 0 ;; ++ exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 +- exit 0 ;; ++ exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 +- exit 0;; ++ exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos +- exit 0 ;; ++ exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos +- exit 0 ;; ++ exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition +- exit 0 ;; ++ exit ;; ++ *:z/VM:*:*) ++ echo s390-ibm-zvmoe ++ exit ;; ++ *:OS400:*:*) ++ echo powerpc-ibm-os400 ++ exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} +- exit 0;; ++ exit ;; ++ arm:riscos:*:*|arm:RISCOS:*:*) ++ echo arm-unknown-riscos ++ exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp +- exit 0;; ++ exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then +@@ -327,32 +314,51 @@ + else + echo pyramid-pyramid-bsd + fi +- exit 0 ;; ++ exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 +- exit 0 ;; ++ exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 +- exit 0 ;; +- DRS?6000:UNIX_SV:4.2*:7*) ++ exit ;; ++ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in +- sparc) echo sparc-icl-nx7 && exit 0 ;; ++ sparc) echo sparc-icl-nx7; exit ;; + esac ;; ++ s390x:SunOS:*:*) ++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; +- i86pc:SunOS:5.*:*) +- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; ++ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) ++ echo i386-pc-auroraux${UNAME_RELEASE} ++ exit ;; ++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) ++ eval $set_cc_for_build ++ SUN_ARCH="i386" ++ # If there is a compiler, see if it is configured for 64-bit objects. ++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. ++ # This test works for both compilers. ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ SUN_ARCH="x86_64" ++ fi ++ fi ++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) +@@ -361,10 +367,10 @@ + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` +- exit 0 ;; ++ exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 +@@ -376,10 +382,10 @@ + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac +- exit 0 ;; ++ exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor +@@ -390,37 +396,40 @@ + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ m68k:machten:*:*) ++ echo m68k-apple-machten${UNAME_RELEASE} ++ exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 +- exit 0 ;; ++ exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +@@ -444,32 +453,33 @@ + exit (-1); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c \ +- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ +- && exit 0 ++ $CC_FOR_BUILD -o $dummy $dummy.c && ++ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && ++ SYSTEM_NAME=`$dummy $dummyarg` && ++ { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax +- exit 0 ;; ++ exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax +- exit 0 ;; ++ exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax +- exit 0 ;; ++ exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix +- exit 0 ;; ++ exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 +- exit 0 ;; ++ exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 +- exit 0 ;; ++ exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 +- exit 0 ;; ++ exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` +@@ -485,29 +495,29 @@ + else + echo i586-dg-dgux${UNAME_RELEASE} + fi +- exit 0 ;; ++ exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 +- exit 0 ;; ++ exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 +- exit 0 ;; ++ exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 +- exit 0 ;; ++ exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd +- exit 0 ;; ++ exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` +- exit 0 ;; ++ exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. +- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id +- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' ++ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id ++ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix +- exit 0 ;; ++ exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` +@@ -515,7 +525,7 @@ + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} +- exit 0 ;; ++ exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build +@@ -530,15 +540,19 @@ + exit(0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 +- echo rs6000-ibm-aix3.2.5 ++ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` ++ then ++ echo "$SYSTEM_NAME" ++ else ++ echo rs6000-ibm-aix3.2.5 ++ fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi +- exit 0 ;; +- *:AIX:*:[45]) ++ exit ;; ++ *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 +@@ -551,28 +565,28 @@ + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} +- exit 0 ;; ++ exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix +- exit 0 ;; ++ exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 +- exit 0 ;; ++ exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to +- exit 0 ;; # report: romp-ibm BSD 4.3 ++ exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx +- exit 0 ;; ++ exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 +- exit 0 ;; ++ exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd +- exit 0 ;; ++ exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 +- exit 0 ;; ++ exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in +@@ -634,9 +648,19 @@ + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then +- # avoid double evaluation of $set_cc_for_build +- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build +- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null ++ eval $set_cc_for_build ++ ++ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating ++ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler ++ # generating 64-bit code. GNU and HP use different nomenclature: ++ # ++ # $ CC_FOR_BUILD=cc ./config.guess ++ # => hppa2.0w-hp-hpux11.23 ++ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess ++ # => hppa64-hp-hpux11.23 ++ ++ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | ++ grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else +@@ -644,11 +668,11 @@ + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} +- exit 0 ;; ++ exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} +- exit 0 ;; ++ exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +@@ -676,208 +700,248 @@ + exit (0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 ++ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && ++ { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 +- exit 0 ;; ++ exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd +- exit 0 ;; ++ exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd +- exit 0 ;; ++ exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix +- exit 0 ;; ++ exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf +- exit 0 ;; ++ exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf +- exit 0 ;; ++ exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi +- exit 0 ;; ++ exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites +- exit 0 ;; ++ exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd +- exit 0 ;; ++ exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit 0 ;; ++ exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd +- exit 0 ;; ++ exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd +- exit 0 ;; ++ exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd +- exit 0 ;; ++ exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + *:UNICOS/mp:*:*) +- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit 0 ;; ++ exit ;; ++ 5000:UNIX_System_V:4.*:*) ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` ++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} +- exit 0 ;; +- *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) +- # Determine whether the default compiler uses glibc. +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include <features.h> +- #if __GLIBC__ >= 2 +- LIBC=gnu +- #else +- LIBC= +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} +- exit 0 ;; ++ exit ;; ++ *:FreeBSD:*:*) ++ case ${UNAME_MACHINE} in ++ pc98) ++ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ amd64) ++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ *) ++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ esac ++ exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin +- exit 0 ;; +- i*:MINGW*:*) ++ exit ;; ++ *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 +- exit 0 ;; ++ exit ;; ++ i*:windows32*:*) ++ # uname -m includes "-pc" on this system. ++ echo ${UNAME_MACHINE}-mingw32 ++ exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 +- exit 0 ;; +- x86:Interix*:[34]*) +- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' +- exit 0 ;; ++ exit ;; ++ *:Interix*:*) ++ case ${UNAME_MACHINE} in ++ x86) ++ echo i586-pc-interix${UNAME_RELEASE} ++ exit ;; ++ authenticamd | genuineintel | EM64T) ++ echo x86_64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ IA64) ++ echo ia64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks +- exit 0 ;; ++ exit ;; ++ 8664:Windows_NT:*) ++ echo x86_64-pc-mks ++ exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix +- exit 0 ;; ++ exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin +- exit 0 ;; ++ exit ;; ++ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) ++ echo x86_64-unknown-cygwin ++ exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin +- exit 0 ;; ++ exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + *:GNU:*:*) ++ # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` +- exit 0 ;; ++ exit ;; ++ *:GNU/*:*:*) ++ # other systems with GNU libc and userland ++ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu ++ exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix +- exit 0 ;; ++ exit ;; ++ alpha:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ EV5) UNAME_MACHINE=alphaev5 ;; ++ EV56) UNAME_MACHINE=alphaev56 ;; ++ PCA56) UNAME_MACHINE=alphapca56 ;; ++ PCA57) UNAME_MACHINE=alphapca56 ;; ++ EV6) UNAME_MACHINE=alphaev6 ;; ++ EV67) UNAME_MACHINE=alphaev67 ;; ++ EV68*) UNAME_MACHINE=alphaev68 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi ++ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ++ exit ;; + arm*:Linux:*:*) ++ eval $set_cc_for_build ++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_EABI__ ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ else ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi ++ fi ++ exit ;; ++ avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu +- exit 0 ;; +- ia64:Linux:*:*) +- echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu +- exit 0 ;; +- m68*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; +- mips:Linux:*:*) ++ exit ;; ++ crisv32:Linux:*:*) ++ echo crisv32-axis-linux-gnu ++ exit ;; ++ frv:Linux:*:*) ++ echo frv-unknown-linux-gnu ++ exit ;; ++ i*86:Linux:*:*) ++ LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +- #undef CPU +- #undef mips +- #undef mipsel +- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mipsel +- #else +- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips +- #else +- CPU= +- #endif ++ #ifdef __dietlibc__ ++ LIBC=dietlibc + #endif + EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 +- ;; +- mips64:Linux:*:*) ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}" ++ exit ;; ++ ia64:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ m32r*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ m68*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU +- #undef mips64 +- #undef mips64el ++ #undef ${UNAME_MACHINE} ++ #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mips64el ++ CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips64 ++ CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif + EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` ++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; +- ppc:Linux:*:*) +- echo powerpc-${VENDOR:-unknown}-linux-gnu +- exit 0 ;; +- ppc64:Linux:*:*) +- echo powerpc64-${VENDOR:-unknown}-linux-gnu +- exit 0 ;; +- alpha:Linux:*:*) +- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in +- EV5) UNAME_MACHINE=alphaev5 ;; +- EV56) UNAME_MACHINE=alphaev56 ;; +- PCA56) UNAME_MACHINE=alphapca56 ;; +- PCA57) UNAME_MACHINE=alphapca56 ;; +- EV6) UNAME_MACHINE=alphaev6 ;; +- EV67) UNAME_MACHINE=alphaev67 ;; +- EV68*) UNAME_MACHINE=alphaev68 ;; +- esac +- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null +- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi +- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} +- exit 0 ;; ++ or32:Linux:*:*) ++ echo or32-unknown-linux-gnu ++ exit ;; ++ padre:Linux:*:*) ++ echo sparc-unknown-linux-gnu ++ exit ;; ++ parisc64:Linux:*:* | hppa64:Linux:*:*) ++ echo hppa64-unknown-linux-gnu ++ exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in +@@ -885,84 +949,40 @@ + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac +- exit 0 ;; +- parisc64:Linux:*:* | hppa64:Linux:*:*) +- echo hppa64-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ ppc64:Linux:*:*) ++ echo powerpc64-unknown-linux-gnu ++ exit ;; ++ ppc:Linux:*:*) ++ echo powerpc-unknown-linux-gnu ++ exit ;; + s390:Linux:*:* | s390x:Linux:*:*) +- echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-ibm-linux ++ exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ vax:Linux:*:*) ++ echo ${UNAME_MACHINE}-dec-linux-gnu ++ exit ;; + x86_64:Linux:*:*) +- echo x86_64-${VENDOR:-unknown}-linux-gnu +- exit 0 ;; +- i*86:Linux:*:*) +- # The BFD linker knows what the default object file format is, so +- # first see if it will tell us. cd to the root directory to prevent +- # problems with other programs or directories called `ld' in the path. +- # Set LC_ALL=C to ensure ld outputs messages in English. +- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ +- | sed -ne '/supported targets:/!d +- s/[ ][ ]*/ /g +- s/.*supported targets: *// +- s/ .*// +- p'` +- case "$ld_supported_targets" in +- elf32-i386) +- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" +- ;; +- a.out-i386-linux) +- echo "${UNAME_MACHINE}-pc-linux-gnuaout" +- exit 0 ;; +- coff-i386) +- echo "${UNAME_MACHINE}-pc-linux-gnucoff" +- exit 0 ;; +- "") +- # Either a pre-BFD a.out linker (linux-gnuoldld) or +- # one that does not give us useful --help. +- echo "${UNAME_MACHINE}-pc-linux-gnuoldld" +- exit 0 ;; +- esac +- # Determine whether the default compiler is a.out or elf +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include <features.h> +- #ifdef __ELF__ +- # ifdef __GLIBC__ +- # if __GLIBC__ >= 2 +- LIBC=gnu +- # else +- LIBC=gnulibc1 +- # endif +- # else +- LIBC=gnulibc1 +- # endif +- #else +- #ifdef __INTEL_COMPILER +- LIBC=gnu +- #else +- LIBC=gnuaout +- #endif +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0 +- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 +- ;; ++ echo x86_64-unknown-linux-gnu ++ exit ;; ++ xtensa*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 +- exit 0 ;; ++ exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... +@@ -970,24 +990,27 @@ + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} +- exit 0 ;; ++ exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx +- exit 0 ;; ++ exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop +- exit 0 ;; ++ exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos +- exit 0 ;; +- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) ++ exit ;; ++ i*86:syllable:*:*) ++ echo ${UNAME_MACHINE}-pc-syllable ++ exit ;; ++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp +- exit 0 ;; ++ exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then +@@ -995,15 +1018,16 @@ + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi +- exit 0 ;; +- i*86:*:5:[78]*) ++ exit ;; ++ i*86:*:5:[678]*) ++ # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} +- exit 0 ;; ++ exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` +@@ -1021,73 +1045,86 @@ + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi +- exit 0 ;; ++ exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about +- # the processor, so we play safe by assuming i386. +- echo i386-pc-msdosdjgpp +- exit 0 ;; ++ # the processor, so we play safe by assuming i586. ++ # Note: whatever this is, it MUST be the same as what config.sub ++ # prints for the "djgpp" host, or else GDB configury will decide that ++ # this is a cross-build. ++ echo i586-pc-msdosdjgpp ++ exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 +- exit 0 ;; ++ exit ;; + paragon:*:*:*) + echo i860-intel-osf1 +- exit 0 ;; ++ exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi +- exit 0 ;; ++ exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv +- exit 0 ;; ++ exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv +- exit 0 ;; ++ exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix +- exit 0 ;; +- M68*:*:R3V[567]*:*) +- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; +- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) ++ exit ;; ++ M68*:*:R3V[5678]*:*) ++ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; ++ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && echo i486-ncr-sysv4.3${OS_REL} && exit 0 ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ +- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && echo i486-ncr-sysv4 && exit 0 ;; ++ && { echo i486-ncr-sysv4; exit; } ;; ++ NCR*:*:4.2:* | MPRAS*:*:4.2:*) ++ OS_REL='.3' ++ test -r /etc/.relid \ ++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 +- exit 0 ;; ++ exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; +- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) ++ exit ;; ++ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 +- exit 0 ;; ++ exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 +- exit 0 ;; ++ exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` +@@ -1095,68 +1132,94 @@ + else + echo ns32k-sni-sysv + fi +- exit 0 ;; ++ exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 +- exit 0 ;; ++ exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 +- exit 0 ;; ++ exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 +- exit 0 ;; ++ exit ;; ++ i*86:VOS:*:*) ++ # From Paul.Green@stratus.com. ++ echo ${UNAME_MACHINE}-stratus-vos ++ exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos +- exit 0 ;; ++ exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 +- exit 0 ;; ++ exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi +- exit 0 ;; ++ exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos +- exit 0 ;; ++ exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos +- exit 0 ;; ++ exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos +- exit 0 ;; ++ exit ;; ++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. ++ echo i586-pc-haiku ++ exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ SX-7:SUPER-UX:*:*) ++ echo sx7-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8:SUPER-UX:*:*) ++ echo sx8-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8R:SUPER-UX:*:*) ++ echo sx8r-nec-superux${UNAME_RELEASE} ++ exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Darwin:*:*) +- case `uname -p` in +- *86) UNAME_PROCESSOR=i686 ;; +- powerpc) UNAME_PROCESSOR=powerpc ;; ++ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown ++ case $UNAME_PROCESSOR in ++ i386) ++ eval $set_cc_for_build ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ UNAME_PROCESSOR="x86_64" ++ fi ++ fi ;; ++ unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then +@@ -1164,22 +1227,25 @@ + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:QNX:*:4*) + echo i386-pc-qnx +- exit 0 ;; +- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) ++ exit ;; ++ NSE-?:NONSTOP_KERNEL:*:*) ++ echo nse-tandem-nsk${UNAME_RELEASE} ++ exit ;; ++ NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux +- exit 0 ;; ++ exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv +- exit 0 ;; ++ exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 +@@ -1190,28 +1256,50 @@ + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 +- exit 0 ;; ++ exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 +- exit 0 ;; ++ exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex +- exit 0 ;; ++ exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 +- exit 0 ;; ++ exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 +- exit 0 ;; ++ exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 +- exit 0 ;; ++ exit ;; + *:ITS:*:*) + echo pdp10-unknown-its +- exit 0 ;; ++ exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ *:DragonFly:*:*) ++ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ++ exit ;; ++ *:*VMS:*:*) ++ UNAME_MACHINE=`(uname -p) 2>/dev/null` ++ case "${UNAME_MACHINE}" in ++ A*) echo alpha-dec-vms ; exit ;; ++ I*) echo ia64-dec-vms ; exit ;; ++ V*) echo vax-dec-vms ; exit ;; ++ esac ;; ++ *:XENIX:*:SysV) ++ echo i386-pc-xenix ++ exit ;; ++ i*86:skyos:*:*) ++ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' ++ exit ;; ++ i*86:rdos:*:*) ++ echo ${UNAME_MACHINE}-pc-rdos ++ exit ;; ++ i*86:AROS:*:*) ++ echo ${UNAME_MACHINE}-pc-aros ++ exit ;; + esac + + #echo '(No uname command or uname output not recognized.)' 1>&2 +@@ -1243,7 +1331,7 @@ + #endif + + #if defined (__arm) && defined (__acorn) && defined (__unix) +- printf ("arm-acorn-riscix"); exit (0); ++ printf ("arm-acorn-riscix\n"); exit (0); + #endif + + #if defined (hp300) && !defined (hpux) +@@ -1332,11 +1420,12 @@ + } + EOF + +-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 ++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && ++ { echo "$SYSTEM_NAME"; exit; } + + # Apollos put the system type in the environment. + +-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } ++test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + + # Convex versions that predate uname can use getsysinfo(1) + +@@ -1345,22 +1434,22 @@ + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd +- exit 0 ;; ++ exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit 0 ;; ++ exit ;; + c34*) + echo c34-convex-bsd +- exit 0 ;; ++ exit ;; + c38*) + echo c38-convex-bsd +- exit 0 ;; ++ exit ;; + c4*) + echo c4-convex-bsd +- exit 0 ;; ++ exit ;; + esac + fi + +@@ -1371,7 +1460,9 @@ + the operating system you are using. It is advised that you + download the most up to date version of the config scripts from + +- ftp://ftp.gnu.org/pub/gnu/config/ ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD ++and ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + + If the version you run ($0) is already up to date, please + send the following data and any information you think might be +--- misc/xmlsec1-1.2.12/config.sub 2010-04-15 09:29:35.000000000 +0000 ++++ misc/build/xmlsec1-1.2.12/config.sub 2010-04-15 09:29:46.000000000 +0000 +@@ -1,9 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ++# Free Software Foundation, Inc. + +-timestamp='2003-06-18' ++timestamp='2010-01-22' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -21,22 +22,26 @@ + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, +-# Boston, MA 02111-1307, USA. +- ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA ++# 02110-1301, USA. ++# + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + ++ + # Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted ChangeLog entry. ++# diff and a properly formatted GNU ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD ++ + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -70,8 +75,9 @@ + version="\ + GNU config.sub ($timestamp) + +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free ++Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -83,11 +89,11 @@ + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit 0 ;; ++ echo "$timestamp" ; exit ;; + --version | -v ) +- echo "$version" ; exit 0 ;; ++ echo "$version" ; exit ;; + --help | --h* | -h ) +- echo "$usage"; exit 0 ;; ++ echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. +@@ -99,7 +105,7 @@ + *local*) + # First pass through any local machine types. + echo $1 +- exit 0;; ++ exit ;; + + * ) + break ;; +@@ -118,7 +124,10 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) ++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ ++ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ ++ kopensolaris*-gnu* | \ ++ storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -144,10 +153,13 @@ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis) ++ -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; ++ -bluegene*) ++ os=-cnk ++ ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -169,6 +181,10 @@ + -hiux*) + os=-hiuxwe2 + ;; ++ -sco6) ++ os=-sco5v6 ++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ++ ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +@@ -185,6 +201,10 @@ + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -sco5v6*) ++ # Don't forget version if it is 3.2v4 or newer. ++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ++ ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +@@ -228,54 +248,71 @@ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ +- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ ++ | am33_2.0 \ ++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ ++ | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ +- | fr30 | frv \ ++ | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ +- | ip2k \ +- | m32r | m68000 | m68k | m88k | mcore \ ++ | ip2k | iq2000 \ ++ | lm32 \ ++ | m32c | m32r | m32rle | m68000 | m68k | m88k \ ++ | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ +- | mips64vr | mips64vrel \ ++ | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ ++ | mips64r5900 | mips64r5900el \ ++ | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ ++ | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ ++ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ ++ | moxie \ ++ | mt \ + | msp430 \ ++ | nios | nios2 \ + | ns16k | ns32k \ +- | openrisc | or32 \ ++ | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ +- | s390 | s390x \ +- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ ++ | rx \ ++ | score \ ++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ +- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ +- | strongarm \ ++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ ++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ ++ | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ ++ | ubicom32 \ + | v850 | v850e \ + | we32k \ +- | x86 | xscale | xstormy16 | xtensa \ +- | z8k) ++ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ ++ | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12) ++ m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; ++ ms1) ++ basic_machine=mt-unknown ++ ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and +@@ -295,55 +332,69 @@ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ +- | avr-* \ +- | bs2000-* \ ++ | avr-* | avr32-* \ ++ | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ +- | clipper-* | cydra-* \ ++ | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ +- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ +- | ip2k-* \ +- | m32r-* \ ++ | ip2k-* | iq2000-* \ ++ | lm32-* \ ++ | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | mcore-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +- | mips64vr-* | mips64vrel-* \ ++ | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ ++ | mips64r5900-* | mips64r5900el-* \ ++ | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ ++ | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ ++ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ ++ | mmix-* \ ++ | mt-* \ + | msp430-* \ +- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ ++ | nios-* | nios2-* \ ++ | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ +- | romp-* | rs6000-* \ +- | s390-* | s390x-* \ +- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ ++ | romp-* | rs6000-* | rx-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ +- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ +- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ ++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ ++ | sparclite-* \ ++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tile-* | tilegx-* \ + | tron-* \ ++ | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ +- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ +- | xtensa-* \ ++ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ ++ | xstormy16-* | xtensa*-* \ + | ymp-* \ +- | z8k-*) ++ | z8k-* | z80-*) ++ ;; ++ # Recognize the basic CPU types without company name, with glob match. ++ xtensa*) ++ basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +@@ -361,6 +412,9 @@ + basic_machine=a29k-amd + os=-udi + ;; ++ abacus) ++ basic_machine=abacus-unknown ++ ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout +@@ -378,6 +432,9 @@ + amd64) + basic_machine=x86_64-pc + ;; ++ amd64-*) ++ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + amdahl) + basic_machine=580-amdahl + os=-sysv +@@ -401,6 +458,10 @@ + basic_machine=m68k-apollo + os=-bsd + ;; ++ aros) ++ basic_machine=i386-pc ++ os=-aros ++ ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -409,10 +470,26 @@ + basic_machine=ns32k-sequent + os=-dynix + ;; ++ blackfin) ++ basic_machine=bfin-unknown ++ os=-linux ++ ;; ++ blackfin-*) ++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; ++ bluegene*) ++ basic_machine=powerpc-ibm ++ os=-cnk ++ ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; ++ cegcc) ++ basic_machine=arm-unknown ++ os=-cegcc ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -437,12 +514,27 @@ + basic_machine=j90-cray + os=-unicos + ;; ++ craynv) ++ basic_machine=craynv-cray ++ os=-unicosmp ++ ;; ++ cr16) ++ basic_machine=cr16-unknown ++ os=-elf ++ ;; + crds | unos) + basic_machine=m68k-crds + ;; ++ crisv32 | crisv32-* | etraxfs*) ++ basic_machine=crisv32-axis ++ ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; ++ crx) ++ basic_machine=crx-unknown ++ os=-elf ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; +@@ -465,6 +557,14 @@ + basic_machine=m88k-motorola + os=-sysv3 + ;; ++ dicos) ++ basic_machine=i686-pc ++ os=-dicos ++ ;; ++ djgpp) ++ basic_machine=i586-pc ++ os=-msdosdjgpp ++ ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx +@@ -615,6 +715,14 @@ + basic_machine=m68k-isi + os=-sysv + ;; ++ m68knommu) ++ basic_machine=m68k-unknown ++ os=-linux ++ ;; ++ m68knommu-*) ++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + m88k-omron*) + basic_machine=m88k-omron + ;; +@@ -626,10 +734,17 @@ + basic_machine=ns32k-utek + os=-sysv + ;; ++ microblaze) ++ basic_machine=microblaze-xilinx ++ ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; ++ mingw32ce) ++ basic_machine=arm-unknown ++ os=-mingw32ce ++ ;; + miniframe) + basic_machine=m68000-convergent + ;; +@@ -643,10 +758,6 @@ + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; +- mmix*) +- basic_machine=mmix-knuth +- os=-mmixware +- ;; + monitor) + basic_machine=m68k-rom68k + os=-coff +@@ -659,6 +770,9 @@ + basic_machine=i386-pc + os=-msdos + ;; ++ ms1-*) ++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ++ ;; + mvs) + basic_machine=i370-ibm + os=-mvs +@@ -727,10 +841,6 @@ + np1) + basic_machine=np1-gould + ;; +- nv1) +- basic_machine=nv1-cray +- os=-unicosmp +- ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; +@@ -738,9 +848,12 @@ + basic_machine=hppa1.1-oki + os=-proelf + ;; +- or32 | or32-*) ++ openrisc | openrisc-*) + basic_machine=or32-unknown +- os=-coff ++ ;; ++ os400) ++ basic_machine=powerpc-ibm ++ os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson +@@ -758,6 +871,14 @@ + basic_machine=i860-intel + os=-osf + ;; ++ parisc) ++ basic_machine=hppa-unknown ++ os=-linux ++ ;; ++ parisc-*) ++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + pbd) + basic_machine=sparc-tti + ;; +@@ -767,6 +888,12 @@ + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; ++ pc98) ++ basic_machine=i386-pc ++ ;; ++ pc98-*) ++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; +@@ -823,6 +950,10 @@ + basic_machine=i586-unknown + os=-pw32 + ;; ++ rdos) ++ basic_machine=i386-pc ++ os=-rdos ++ ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff +@@ -833,6 +964,12 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; ++ s390 | s390-*) ++ basic_machine=s390-ibm ++ ;; ++ s390x | s390x-*) ++ basic_machine=s390x-ibm ++ ;; + sa29200) + basic_machine=a29k-amd + os=-udi +@@ -843,6 +980,10 @@ + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; ++ sde) ++ basic_machine=mipsisa32-sde ++ os=-elf ++ ;; + sei) + basic_machine=mips-sei + os=-seiux +@@ -854,6 +995,9 @@ + basic_machine=sh-hitachi + os=-hms + ;; ++ sh5el) ++ basic_machine=sh5le-unknown ++ ;; + sh64) + basic_machine=sh64-unknown + ;; +@@ -943,6 +1087,15 @@ + basic_machine=tic6x-unknown + os=-coff + ;; ++ # This must be matched before tile*. ++ tilegx*) ++ basic_machine=tilegx-unknown ++ os=-linux-gnu ++ ;; ++ tile*) ++ basic_machine=tile-unknown ++ os=-linux-gnu ++ ;; + tx39) + basic_machine=mipstx39-unknown + ;; +@@ -956,6 +1109,10 @@ + tower | tower-32) + basic_machine=m68k-ncr + ;; ++ tpf) ++ basic_machine=s390x-ibm ++ os=-tpf ++ ;; + udi29k) + basic_machine=a29k-amd + os=-udi +@@ -999,6 +1156,10 @@ + basic_machine=hppa1.1-winbond + os=-proelf + ;; ++ xbox) ++ basic_machine=i686-pc ++ os=-mingw32 ++ ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; +@@ -1010,6 +1171,10 @@ + basic_machine=z8k-unknown + os=-sim + ;; ++ z80-*-coff) ++ basic_machine=z80-unknown ++ os=-sim ++ ;; + none) + basic_machine=none-none + os=-none +@@ -1029,6 +1194,9 @@ + romp) + basic_machine=romp-ibm + ;; ++ mmix) ++ basic_machine=mmix-knuth ++ ;; + rs6000) + basic_machine=rs6000-ibm + ;; +@@ -1045,13 +1213,10 @@ + we32k) + basic_machine=we32k-att + ;; +- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) ++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; +- sh64) +- basic_machine=sh64-unknown +- ;; +- sparc | sparcv9 | sparcv9b) ++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) +@@ -1098,6 +1263,9 @@ + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. ++ -auroraux) ++ os=-auroraux ++ ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1118,25 +1286,30 @@ + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ ++ | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* \ ++ | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ +- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ +- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ ++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ ++ | -openbsd* | -solidbsd* \ ++ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ ++ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +- | -chorusos* | -chorusrdb* \ ++ | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ +- | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) ++ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1154,12 +1327,15 @@ + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ +- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ ++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; ++ -linux-dietlibc) ++ os=-linux-dietlibc ++ ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; +@@ -1172,6 +1348,9 @@ + -opened*) + os=-openedition + ;; ++ -os400*) ++ os=-os400 ++ ;; + -wince*) + os=-wince + ;; +@@ -1193,6 +1372,9 @@ + -atheos*) + os=-atheos + ;; ++ -syllable*) ++ os=-syllable ++ ;; + -386bsd) + os=-bsd + ;; +@@ -1215,6 +1397,9 @@ + -sinix*) + os=-sysv4 + ;; ++ -tpf*) ++ os=-tpf ++ ;; + -triton*) + os=-sysv3 + ;; +@@ -1251,6 +1436,14 @@ + -kaos*) + os=-kaos + ;; ++ -zvmoe) ++ os=-zvmoe ++ ;; ++ -dicos*) ++ os=-dicos ++ ;; ++ -nacl*) ++ ;; + -none) + ;; + *) +@@ -1273,6 +1466,12 @@ + # system, and we'll never get to this point. + + case $basic_machine in ++ score-*) ++ os=-elf ++ ;; ++ spu-*) ++ os=-elf ++ ;; + *-acorn) + os=-riscix1.2 + ;; +@@ -1282,8 +1481,8 @@ + arm*-semi) + os=-aout + ;; +- c4x-* | tic4x-*) +- os=-coff ++ c4x-* | tic4x-*) ++ os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) +@@ -1310,6 +1509,9 @@ + m68*-cisco) + os=-aout + ;; ++ mep-*) ++ os=-elf ++ ;; + mips*-cisco) + os=-elf + ;; +@@ -1328,9 +1530,15 @@ + *-be) + os=-beos + ;; ++ *-haiku) ++ os=-haiku ++ ;; + *-ibm) + os=-aix + ;; ++ *-knuth) ++ os=-mmixware ++ ;; + *-wec) + os=-proelf + ;; +@@ -1433,7 +1641,7 @@ + -sunos*) + vendor=sun + ;; +- -aix*) ++ -cnk*|-aix*) + vendor=ibm + ;; + -beos*) +@@ -1463,9 +1671,15 @@ + -mvs* | -opened*) + vendor=ibm + ;; ++ -os400*) ++ vendor=ibm ++ ;; + -ptx*) + vendor=sequent + ;; ++ -tpf*) ++ vendor=ibm ++ ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; +@@ -1490,7 +1704,7 @@ + esac + + echo $basic_machine$os +-exit 0 ++exit + + # Local variables: + # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index 3b0871cc36b6..3b0871cc36b6 100644..100755 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx index 49ab2b485c13..2916b2ee6eec 100644 --- a/linguistic/source/convdiclist.cxx +++ b/linguistic/source/convdiclist.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_linguistic.hxx" + #include <tools/fsys.hxx> #include <tools/stream.hxx> #include <tools/urlobj.hxx> diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index be127e0999af..817dbeb311ca 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_linguistic.hxx" +#include <cppuhelper/factory.hxx> +#include <i18npool/mslangid.hxx> #include <osl/file.hxx> #include <tools/fsys.hxx> #include <tools/stream.hxx> @@ -52,6 +54,11 @@ #include "dicimp.hxx" #include "lngopt.hxx" +#include "defs.hxx" +#include "dlistimp.hxx" +#include "dicimp.hxx" +#include "lngopt.hxx" + //using namespace utl; using namespace osl; using namespace rtl; diff --git a/odk/settings/settings.mk b/odk/settings/settings.mk index 74c1393496b2..188ff880255e 100644 --- a/odk/settings/settings.mk +++ b/odk/settings/settings.mk @@ -498,13 +498,37 @@ ifneq (,$(findstring freebsd,$(PLATFORM))) PROCTYPE := $(shell $(PRJ)/config.guess | cut -d"-" -f1) -# Default is freebsd on a intel machine +ifeq (kfreebsd,$(findstring kfreebsd,$(PLATFORM))) +PLATFORM=kfreebsd +ifeq "$(PROCTYPE)" "x86_64" +PACKAGE_LIB_DIR=kfreebsd_x86_64.plt +UNOPKG_PLATFORM=kFreeBSD_x86_64 +else +PACKAGE_LIB_DIR=kfreebsd_x86.plt +UNOPKG_PLATFORM=kFreeBSD_x86 +endif +else PLATFORM=freebsd +ifeq "$(PROCTYPE)" "x86_64" +PACKAGE_LIB_DIR=freebsd_x86_64.plt +UNOPKG_PLATFORM=FreeBSD_x86_64 +else PACKAGE_LIB_DIR=freebsd_x86.plt UNOPKG_PLATFORM=FreeBSD_x86 +endif +endif + +ifeq "$(PROCTYPE)" "x86_64" +JAVA_PROC_TYPE=amd64 +else JAVA_PROC_TYPE=i386 +endif +ifeq (kfreebsd,$(findstring kfreebsd,$(PLATFORM))) +OS=LINUX +else OS=FREEBSD +endif PS=/ ICL=\$$ CC=gcc @@ -520,13 +544,8 @@ SHAREDLIB_OUT=$(OUT_LIB) GCC_VERSION=$(shell $(CC) -dumpversion) -ifeq "$(shell echo $(GCC_VERSION) | cut -c 1)" "3" COMID=gcc3 CPPU_ENV=gcc3 -else -COMID=GCC -CPPU_ENV=gcc2 -endif OSEP=\< CSEP=\> diff --git a/odk/source/unowinreg/win/makefile.mk b/odk/source/unowinreg/win/makefile.mk index eab0826a433c..077d8aa60aac 100644 --- a/odk/source/unowinreg/win/makefile.mk +++ b/odk/source/unowinreg/win/makefile.mk @@ -42,7 +42,6 @@ USE_DEFFILE=TRUE JAVA_INCLUDES:= -I$(JAVA_HOME)/include # values taken from set_soenv.in -.IF "$(JDK)" != "gcj" .IF "$(OS)" == "LINUX" JAVA_INCLUDES+= -I$(JAVA_HOME)/include/linux .ELIF "$(OS)" == "FREEBSD" @@ -52,7 +51,6 @@ JAVA_INCLUDES+= -I$(JAVA_HOME)/include/linux .ELIF "$(OS)" == "NETBSD" JAVA_INCLUDES+= -I$(JAVA_HOME)/include/netbsd .ENDIF -.ENDIF .IF "$(SOLAR_JAVA)"=="" nojava: diff --git a/offapi/com/sun/star/chart/Diagram.idl b/offapi/com/sun/star/chart/Diagram.idl index 0d8ced17f3ef..b57fc88f3804 100644 --- a/offapi/com/sun/star/chart/Diagram.idl +++ b/offapi/com/sun/star/chart/Diagram.idl @@ -31,6 +31,14 @@ #include <com/sun/star/chart/XDiagram.idl> #endif +#ifndef __com_sun_star_chart_XDiagramPositioning_idl__ +#include <com/sun/star/chart/XDiagramPositioning.idl> +#endif + +#ifndef __com_sun_star_chart_XSecondAxisTitleSupplier_idl__ +#include <com/sun/star/chart/XSecondAxisTitleSupplier.idl> +#endif + #ifndef __com_sun_star_beans_XPropertySet_idl__ #include <com/sun/star/beans/XPropertySet.idl> #endif @@ -64,6 +72,17 @@ published service Diagram interface com::sun::star::chart::XDiagram; + /** Provides access to the titles of the secondary X axis and Y axis. + + @since OOo 3.0 + */ + [optional] interface com::sun::star::chart::XSecondAxisTitleSupplier; + + /** + @since OOo 3.3 + */ + [optional] interface com::sun::star::chart::XDiagramPositioning; + //------------------------------------------------------------------------- /** If this property is <TRUE/> the position is calculated by the application automatically. diff --git a/offapi/com/sun/star/chart/XDiagramPositioning.idl b/offapi/com/sun/star/chart/XDiagramPositioning.idl new file mode 100644 index 000000000000..f64bbef4b641 --- /dev/null +++ b/offapi/com/sun/star/chart/XDiagramPositioning.idl @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDiagramPositioning.idl,v $ + * $Revision: 1.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_chart_XDiagramPositioning_idl__ +#define __com_sun_star_chart_XDiagramPositioning_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +#ifndef __com_sun_star_awt_Rectangle_idl__ +#include <com/sun/star/awt/Rectangle.idl> +#endif + +//============================================================================= + + module com { module sun { module star { module chart { + +//============================================================================= + +/** allow for different positioning options for a diagram + + @see Diagram + */ +interface XDiagramPositioning : com::sun::star::uno::XInterface +{ + /** the diagram will be placed automtically + */ + void setAutomaticDiagramPositioning(); + + /** @returns whether the diagram is placed automtically + */ + boolean isAutomaticDiagramPositioning(); + + /** place the inner diagram part excluding any axes, labels and titles + @param PositionRect + specifies the position and size in 100/th mm + */ + void setDiagramPositionExcludingAxes( [in] com::sun::star::awt::Rectangle PositionRect ); + + /** @returns true in case the diagram position was set with method setDiagramPositionExcludingAxes + */ + boolean isExcludingDiagramPositioning(); + + /** @returns the position rectangle of the inner diagram part excluding any axes, labels and titles. + Position and size are given in 100/th mm. + It might be necessary to calculate the positioning so this method can be expensive and the result may depend on different other settings. + */ + com::sun::star::awt::Rectangle calculateDiagramPositionExcludingAxes(); + + + /** place the outer diagram part including the axes and axes labels, but excluding the axes titles. + @param PositionRect + specifies the position and size in 100/th mm + */ + void setDiagramPositionIncludingAxes( [in] com::sun::star::awt::Rectangle PositionRect ); + + /** @returns the position rectangle of the diagram including the axes and axes labels, but excluding the axes titles. + Position and size are given in 100/th mm. + It might be necessary to calculate the positioning so this method can be expensive and the result may depend on different other settings. + */ + com::sun::star::awt::Rectangle calculateDiagramPositionIncludingAxes(); + + /** place the diagram including the axes, axes labels and axes titles. + For the placement the current axis titles are taken into account, so the titles must be initialized properly before this method is called. + @param PositionRect + specifies the position and size in 100/th mm + */ + void setDiagramPositionIncludingAxesAndAxisTitles( [in] com::sun::star::awt::Rectangle PositionRect ); + + /** @returns the position rectangle of the diagram including the axes, axes labels and axes titles. + Position and size are given in 100/th mm. + It might be necessary to calculate the positioning so this method can be expensive and the result may depend on different other settings. + */ + com::sun::star::awt::Rectangle calculateDiagramPositionIncludingAxesAndAxisTitles(); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/chart/makefile.mk b/offapi/com/sun/star/chart/makefile.mk index 2c0b93256b3b..fdbf07173c5e 100644 --- a/offapi/com/sun/star/chart/makefile.mk +++ b/offapi/com/sun/star/chart/makefile.mk @@ -105,6 +105,7 @@ IDLFILES=\ XChartDocument.idl\ XComplexDescriptionAccess.idl\ XDiagram.idl\ + XDiagramPositioning.idl\ XStatisticDisplay.idl\ XTwoAxisXSupplier.idl\ XTwoAxisYSupplier.idl\ diff --git a/offapi/com/sun/star/chart2/Diagram.idl b/offapi/com/sun/star/chart2/Diagram.idl index a048b91a2347..2ca0e1ade86d 100644 --- a/offapi/com/sun/star/chart2/Diagram.idl +++ b/offapi/com/sun/star/chart2/Diagram.idl @@ -77,6 +77,10 @@ service Diagram */ [property] ::com::sun::star::layout::RelativeSize RelativeSize; + /** The attributes RelativePosition and RelativeSize should be used for the inner coordinate region without axis labels and without data labels. + */ + [optional, property] boolean PosSizeExcludeLabels; + /** Sort data points by x values for rendering */ [optional, property] boolean SortByXValues; diff --git a/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl b/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl new file mode 100644 index 000000000000..17cd0d6a7ba6 --- /dev/null +++ b/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TransliterationModulesExtra.idl,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_i18n_TransliterationModulesExtra_idl__ +#define __com_sun_star_i18n_TransliterationModulesExtra_idl__ + +//============================================================================= + +module com { module sun { module star { module i18n { + +//============================================================================= + +/** Extra transliteration module enumeration to use with + <member>XTransliteration::loadModule()</member> + + The values used in this group need to be different from the ones in + <type>TransliterationModules</type> and <type>TransliterationModulesNew</type>! + */ + + +// using a constant group instead of enum leaves room for additional values later on... +constants TransliterationModulesExtra +{ + /** The first character of the sentence is put in upper case + */ + const short SENTENCE_CASE = 200; + + //------------------------------------------------------------------------- + + /** The first character of the word is put in upper case. + * This one is part + */ + const short TITLE_CASE = 201; + + //------------------------------------------------------------------------- + + /** All characters of the word are to change their case from small letters + * to capital letters and vice versa. + */ + const short TOGGLE_CASE = 202; + + //------------------------------------------------------------------------- + + const long END_OF_MODULE = 0; +}; + +//============================================================================= +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/i18n/makefile.mk b/offapi/com/sun/star/i18n/makefile.mk index 71907e42c6d9..7d861fa1436d 100644 --- a/offapi/com/sun/star/i18n/makefile.mk +++ b/offapi/com/sun/star/i18n/makefile.mk @@ -94,6 +94,7 @@ IDLFILES=\ Transliteration.idl \ TransliterationModules.idl \ TransliterationModulesNew.idl \ + TransliterationModulesExtra.idl \ TransliterationType.idl \ UnicodeScript.idl \ UnicodeType.idl \ diff --git a/offapi/com/sun/star/sheet/XExternalDocLink.idl b/offapi/com/sun/star/sheet/XExternalDocLink.idl index 19d1f0ff08d7..1a9662dbeed7 100644 --- a/offapi/com/sun/star/sheet/XExternalDocLink.idl +++ b/offapi/com/sun/star/sheet/XExternalDocLink.idl @@ -60,9 +60,16 @@ interface XExternalDocLink @param aSheetName sheet name + @param DynamicCache specify whether or not the cache can grow when + non-cached regions are queried. If <true/>, querying a non-cached + cell in this sheet cache will allow Calc to try to access the source + document to fetch the value in first access. If <false/>, the source + document will not be accessed, and the non-cached regions are treated + as empty cells. + @return com::sun::star::sheet::XExternalSheetCache sheet cache instance */ - com::sun::star::sheet::XExternalSheetCache addSheetCache( [in] string aSheetName ); + com::sun::star::sheet::XExternalSheetCache addSheetCache( [in] string aSheetName, [in] boolean DynamicCache ); //------------------------------------------------------------------------- diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index bedc9bf1420d..5c735744104b 100755 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -535,7 +535,7 @@ </node> <node oor:name="F7_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="en-US">.uno:Thesaurus</value> + <value xml:lang="en-US">.uno:ThesaurusDialog</value> </prop> </node> <node oor:name="F7_SHIFT" oor:op="replace"> @@ -568,6 +568,11 @@ <value xml:lang="en-US">.uno:CalculateHard</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> @@ -1077,7 +1082,7 @@ </node> <node oor:name="F7_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="en-US">.uno:Thesaurus</value> + <value xml:lang="en-US">.uno:ThesaurusDialog</value> </prop> </node> <node oor:name="F8" oor:op="replace"> @@ -1090,6 +1095,11 @@ <value xml:lang="en-US">.uno:TextFitToSize</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> @@ -1566,6 +1576,11 @@ <value xml:lang="en-US">.uno:UpdateInputFields</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> @@ -2041,7 +2056,7 @@ </node> <node oor:name="F7_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="en-US">.uno:Thesaurus</value> + <value xml:lang="en-US">.uno:ThesaurusDialog</value> </prop> </node> <node oor:name="F8" oor:op="replace"> @@ -2054,6 +2069,11 @@ <value xml:lang="en-US">.uno:TextFitToSize</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> @@ -2597,6 +2617,11 @@ <value xml:lang="en-US">.uno:UpdateInputFields</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> @@ -4442,6 +4467,11 @@ <value xml:lang="en-US">.uno:UpdateInputFields</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> @@ -5052,6 +5082,11 @@ <value xml:lang="en-US">.uno:UpdateInputFields</value> </prop> </node> + <node oor:name="F_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">vnd.sun.star.findbar:FocusToFindbar</value> + </prop> + </node> <node oor:name="F_SHIFT_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="de">.uno:Bold</value> diff --git a/officecfg/registry/data/org/openoffice/Office/ProtocolHandler.xcu b/officecfg/registry/data/org/openoffice/Office/ProtocolHandler.xcu index 8ef8fcd259e0..0d5dd5e3b499 100644 --- a/officecfg/registry/data/org/openoffice/Office/ProtocolHandler.xcu +++ b/officecfg/registry/data/org/openoffice/Office/ProtocolHandler.xcu @@ -63,5 +63,10 @@ <value>vnd.sun.star.popup:*</value> </prop> </node> + <node oor:name="com.sun.star.comp.svx.FindbarDispatcher" oor:op="replace"> + <prop oor:name="Protocols"> + <value>vnd.sun.star.findbar:*</value> + </prop> + </node> </node> </oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu index c5d32679b108..a427a0caf052 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu @@ -293,6 +293,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> <node oor:name="private:resource/toolbar/textobjectbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index 664bff660ca0..0054c7af24f1 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -383,6 +383,39 @@ <value>com.sun.star.comp.chart2.ShapeToolbarController</value> </prop> </node> + <node oor:name="com.sun.star.svx.FindTextToolboxController" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:FindText</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.svx.FindTextToolboxController</value> + </prop> + </node> + <node oor:name="com.sun.star.svx.DownSearchToolboxController" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:DownSearch</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.svx.DownSearchToolboxController</value> + </prop> + </node> + <node oor:name="com.sun.star.svx.UpSearchToolboxController" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:UpSearch</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.svx.UpSearchToolboxController</value> + </prop> + </node> </node> <node oor:name="StatusBar"> <node oor:name="c1" oor:op="replace"> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu index 53d2ca72cbf4..c0feaba64dc6 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu @@ -106,6 +106,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> <node oor:name="private:resource/toolbar/drawingobjectbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 622b5a042730..ebed194fcffc 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1459,6 +1459,38 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:FindText" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Find Text</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:DownSearch" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Find Next</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:UpSearch" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Find Previous</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name="vnd.sun.star.findbar:FocusToFindbar" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Focus to Findbar</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:ExtendedHelp" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">What's ~This?</value> @@ -2090,22 +2122,22 @@ <value>1</value> </prop> </node> - <node oor:name=".uno:ChangeCaseToUpper" oor:op="replace"> + <node oor:name=".uno:LanguageStatus" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Language Status</value> + </prop> + </node> + <node oor:name=".uno:ChooseControls" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">~Uppercase</value> + <value xml:lang="en-US">Insert Controls</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>1</value> </prop> </node> - <node oor:name=".uno:LanguageStatus" oor:op="replace"> - <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Language Status</value> - </prop> - </node> - <node oor:name=".uno:ChooseControls" oor:op="replace"> + <node oor:name=".uno:ChangeCaseToSentenceCase" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Insert Controls</value> + <value xml:lang="en-US">~Sentence case</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>1</value> @@ -2113,7 +2145,31 @@ </node> <node oor:name=".uno:ChangeCaseToLower" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">~Lowercase</value> + <value xml:lang="en-US">~lowercase</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:ChangeCaseToUpper" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~UPPERCASE</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:ChangeCaseToTitleCase" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Capitalize Every Word</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:ChangeCaseToToggleCase" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~tOGGLE cASE</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>1</value> @@ -2989,7 +3045,7 @@ <value xml:lang="en-US">New FrameSet</value> </prop> </node> - <node oor:name=".uno:Thesaurus" oor:op="replace"> + <node oor:name=".uno:ThesaurusDialog" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Thesaurus...</value> </prop> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu index de59f330d340..e582c0b9dc27 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu @@ -870,6 +870,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> </node> </node> </oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu index 870e3c5c528b..8bcc180c264b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu @@ -52,6 +52,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> <node oor:name="private:resource/toolbar/textobjectbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterWebWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterWebWindowState.xcu index 8c0eccc927e9..35844d1bd516 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterWebWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterWebWindowState.xcu @@ -52,6 +52,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> <node oor:name="private:resource/toolbar/textobjectbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu index 60417cae30fa..d3790df3ef92 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu @@ -52,6 +52,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> <node oor:name="private:resource/toolbar/textobjectbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/XFormsWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/XFormsWindowState.xcu index f78926234b35..76cdc52f5e3a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/XFormsWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/XFormsWindowState.xcu @@ -53,6 +53,26 @@ <value>true</value> </prop> </node> + <node oor:name="private:resource/toolbar/findbar" oor:op="replace"> + <prop oor:name="DockPos" oor:type="xs:string"> + <value>1,0</value> + </prop> + <prop oor:name="Docked" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="DockingArea" oor:type="xs:int"> + <value>0</value> + </prop> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Find</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="ContextSensitive" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> <node oor:name="private:resource/toolbar/textobjectbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index d59e2f889a0b..63b22726378b 100755 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -801,13 +801,13 @@ <node oor:name="Common" oor:op="replace"> <prop oor:name="IncludedFiles"> <value> - .*/autotext/.* - .*/autocorr/.* - .*/config/.*\.so[bcdegh] - .*/config/soffice.cfg/modules/.*/toolbar/custom.*\.xml - .*/config/soffice.cfg/modules/.*/images/.* - .*/gallery/.* - .*/template/.* + <it>.*/autotext/.*</it> + <it>.*/autocorr/.*</it> + <it>.*/config/.*\.so[bcdegh]</it> + <it>.*/config/soffice.cfg/modules/.*/toolbar/custom.*\.xml</it> + <it>.*/config/soffice.cfg/modules/.*/images/.*</it> + <it>.*/gallery/.*</it> + <it>.*/template/.*</it> </value> </prop> <prop oor:name="IncludedNodes"> diff --git a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs index 220d94c89da6..7cb13b70700c 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs @@ -121,6 +121,31 @@ <label>Spell and grammar context menu dictionary image</label> </info> </prop> + <prop oor:name="ThesaurusDialogImage" oor:type="xs:string"> + <info> + <desc>The path to the image for the thesaurus dialog.</desc> + <label>Thesaurus dialog image</label> + </info> + </prop> + <prop oor:name="ThesaurusDialogImage_HC" oor:type="xs:string"> + <info> + <desc>The path to the image for the thesaurus dialog in high contrast mode.</desc> + <label>Thesaurus dialog image</label> + </info> + </prop> + <prop oor:name="SynonymsContextMenuImage" oor:type="xs:string"> + <info> + <desc>The path to the image for the synonyms context menu.</desc> + <label>Synonyms context menu image</label> + </info> + </prop> + <prop oor:name="SynonymsContextMenuImage_HC" oor:type="xs:string"> + <info> + <desc>The path to the image for the synonyms context menu in high contrast mode.</desc> + <label>Synonyms context menu image</label> + </info> + </prop> + </group> <group oor:name="GrammarCheckerEntry"> diff --git a/oox/inc/oox/drawingml/chart/axisconverter.hxx b/oox/inc/oox/drawingml/chart/axisconverter.hxx index 4e8f86279133..925fa1fe8b4f 100644 --- a/oox/inc/oox/drawingml/chart/axisconverter.hxx +++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx @@ -41,15 +41,6 @@ namespace chart { // ============================================================================ -const sal_Int32 API_PRIM_AXESSET = 0; -const sal_Int32 API_SECN_AXESSET = 1; - -const sal_Int32 API_X_AXIS = 0; -const sal_Int32 API_Y_AXIS = 1; -const sal_Int32 API_Z_AXIS = 2; - -// ============================================================================ - struct AxisModel; class TypeGroupConverter; diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx index 470596a5228e..f034b4b6e6bb 100644 --- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx +++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx @@ -79,6 +79,21 @@ public: // ============================================================================ +struct LayoutModel; + +/** Handler for a chart layout context (c:layout element). + */ +class LayoutContext : public ContextBase< LayoutModel > +{ +public: + explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel ); + virtual ~LayoutContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx index 23f5a5ff9266..c937c6e94900 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -32,9 +32,12 @@ #include "oox/drawingml/chart/objectformatter.hxx" namespace com { namespace sun { namespace star { + namespace awt { struct Rectangle; } namespace awt { struct Size; } namespace lang { class XMultiServiceFactory; } namespace chart2 { class XChartDocument; } + namespace chart2 { class XTitle; } + namespace drawing { class XShape; } } } } namespace oox { namespace core { @@ -45,13 +48,21 @@ namespace oox { namespace drawingml { namespace chart { -// ============================================================================ - class ChartConverter; -class ObjectFormatter; struct ChartSpaceModel; struct ConverterData; +// ============================================================================ + +const sal_Int32 API_PRIM_AXESSET = 0; +const sal_Int32 API_SECN_AXESSET = 1; + +const sal_Int32 API_X_AXIS = 0; +const sal_Int32 API_Y_AXIS = 1; +const sal_Int32 API_Z_AXIS = 2; + +// ============================================================================ + class ConverterRoot { public: @@ -63,12 +74,6 @@ public: const ::com::sun::star::awt::Size& rChartSize ); virtual ~ConverterRoot(); - /** Creates an instance for the passed service name, using the passed service factory. */ - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - createInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, - const ::rtl::OUString& rServiceName ); - /** Creates an instance for the passed service name, using the process service factory. */ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createInstance( const ::rtl::OUString& rServiceName ) const; @@ -86,12 +91,24 @@ protected: /** Returns the object formatter. */ ObjectFormatter& getFormatter() const; + /** Registers a title object and its layout data, needed for conversion of + the title position using the old Chart1 API. */ + void registerTitleLayout( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle, + const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); + /** Converts the positions of the main title and all axis titles. */ + void convertTitlePositions(); + private: ::boost::shared_ptr< ConverterData > mxData; }; // ============================================================================ +/** Base class of all converter classes. Holds a reference to a model structure + of the specified type. + */ template< typename ModelType > class ConverterBase : public ConverterRoot { @@ -109,6 +126,30 @@ protected: // ============================================================================ +/** A layout converter calculates positions and sizes for various chart objects. + */ +class LayoutConverter : public ConverterBase< LayoutModel > +{ +public: + explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ); + virtual ~LayoutConverter(); + + /** Tries to calculate the absolute position and size from the contained + OOXML layout model. Returns true, if returned rectangle is valid. */ + bool calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const; + + /** Tries to set the position from the contained OOXML layout model. + Returns true, if a manual position could be calculated. */ + bool convertFromModel( PropertySet& rPropSet ); + /** Tries to set the position from the contained OOXML layout model. + Returns true, if a manual position could be calculated. */ + bool convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, + double fRotationAngle ); +}; + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx index 113d6f686fd1..d34970025abd 100644 --- a/oox/inc/oox/drawingml/chart/modelbase.hxx +++ b/oox/inc/oox/drawingml/chart/modelbase.hxx @@ -114,6 +114,25 @@ struct NumberFormat // ============================================================================ +struct LayoutModel +{ + double mfX; /// Left position of this object. + double mfY; /// Top position of this object. + double mfW; /// Width of this object. + double mfH; /// Height of this object. + sal_Int32 mnXMode; /// Mode for left position. + sal_Int32 mnYMode; /// Mode for top position. + sal_Int32 mnWMode; /// Mode for width. + sal_Int32 mnHMode; /// Mode for height. + sal_Int32 mnTarget; /// Layout target for plot area. + bool mbAutoLayout; /// True = automatic positioning. + + explicit LayoutModel(); + ~LayoutModel(); +}; + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx index b2583b2e57a1..e35afb633b92 100644 --- a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx +++ b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx @@ -83,6 +83,8 @@ public: /** Converts the OOXML plot area model to a chart2 diagram. */ void convertFromModel( View3DModel& rView3DModel ); + /** Converts the manual plot area position and size, if set. */ + void convertPositionFromModel(); /** Returns the automatic chart title if the chart contains only one series. */ inline const ::rtl::OUString& getAutomaticTitle() const { return maAutoTitle; } @@ -95,6 +97,7 @@ private: ::rtl::OUString maAutoTitle; bool mb3dChart; bool mbWall3dChart; + bool mbPieChart; }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/plotareamodel.hxx b/oox/inc/oox/drawingml/chart/plotareamodel.hxx index 2dfe1c33f4e3..c5793717defc 100644 --- a/oox/inc/oox/drawingml/chart/plotareamodel.hxx +++ b/oox/inc/oox/drawingml/chart/plotareamodel.hxx @@ -31,7 +31,6 @@ #include "oox/drawingml/shape.hxx" #include "oox/drawingml/chart/axismodel.hxx" #include "oox/drawingml/chart/seriesmodel.hxx" -#include "oox/drawingml/chart/titlemodel.hxx" #include "oox/drawingml/chart/typegroupmodel.hxx" namespace oox { diff --git a/oox/inc/oox/drawingml/chart/seriesconverter.hxx b/oox/inc/oox/drawingml/chart/seriesconverter.hxx index 7f6a08655b17..fd3ca207d7c0 100644 --- a/oox/inc/oox/drawingml/chart/seriesconverter.hxx +++ b/oox/inc/oox/drawingml/chart/seriesconverter.hxx @@ -100,6 +100,18 @@ private: // ============================================================================ +class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel > +{ +public: + explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ); + virtual ~TrendlineLabelConverter(); + + /** Converts the OOXML trendline label. */ + void convertFromModel( PropertySet& rPropSet ); +}; + +// ============================================================================ + class TrendlineConverter : public ConverterBase< TrendlineModel > { public: diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx index b5743cc78f42..b3fec5d93203 100644 --- a/oox/inc/oox/drawingml/chart/titlecontext.hxx +++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx @@ -36,21 +36,6 @@ namespace chart { // ============================================================================ -struct LayoutModel; - -/** Handler for a chart layout context (c:layout element). - */ -class LayoutContext : public ContextBase< LayoutModel > -{ -public: - explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel ); - virtual ~LayoutContext(); - - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); -}; - -// ============================================================================ - struct TextModel; /** Handler for a chart text context (c:tx element). diff --git a/oox/inc/oox/drawingml/chart/titleconverter.hxx b/oox/inc/oox/drawingml/chart/titleconverter.hxx index d1fcfcfcfebc..d153e9f3e760 100644 --- a/oox/inc/oox/drawingml/chart/titleconverter.hxx +++ b/oox/inc/oox/drawingml/chart/titleconverter.hxx @@ -84,7 +84,8 @@ public: /** Creates a title text object and attaches it at the passed interface. */ void convertFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled, - const ::rtl::OUString& rAutoTitle, ObjectType eObjType ); + const ::rtl::OUString& rAutoTitle, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/titlemodel.hxx b/oox/inc/oox/drawingml/chart/titlemodel.hxx index f5d46957b450..f80837249809 100644 --- a/oox/inc/oox/drawingml/chart/titlemodel.hxx +++ b/oox/inc/oox/drawingml/chart/titlemodel.hxx @@ -37,24 +37,6 @@ namespace chart { // ============================================================================ -struct LayoutModel -{ - double mfX; /// Left position of this object. - double mfY; /// Top position of this object. - double mfW; /// Width of this object. - double mfH; /// Height of this object. - sal_Int32 mnXMode; /// Mode for left position. - sal_Int32 mnYMode; /// Mode for top position. - sal_Int32 mnWMode; /// Mode for width. - sal_Int32 mnHMode; /// Mode for height. - sal_Int32 mnTarget; /// Layout target for plot area. - - explicit LayoutModel(); - ~LayoutModel(); -}; - -// ============================================================================ - struct TextModel { typedef ModelRef< DataSequenceModel > DataSequenceRef; diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx index e9016fdf0b2b..e3e712a52a25 100644 --- a/oox/inc/oox/dump/biffdumper.hxx +++ b/oox/inc/oox/dump/biffdumper.hxx @@ -32,6 +32,7 @@ #include "oox/dump/dffdumper.hxx" #include "oox/dump/oledumper.hxx" #include "oox/xls/richstring.hxx" +#include "oox/xls/biffinputstream.hxx" #if OOX_INCLUDE_DUMPER @@ -211,6 +212,10 @@ protected: void dumpRect( const String& rName, const NameListWrapper& rListWrp = NO_LIST, FormatType eFmtType = FORMATTYPE_DEC ); + template< typename Type > + void dumpRectWithGaps( const String& rName, sal_Int32 nGap, + const NameListWrapper& rListWrp = NO_LIST, + FormatType eFmtType = FORMATTYPE_DEC ); sal_uInt16 dumpRepeatedRecId(); void dumpFrHeader( bool bWithFlags, bool bWithRange ); @@ -259,6 +264,22 @@ void BiffObjectBase::dumpRect( const String& rName, writeRectItem( rName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType ); } +template< typename Type > +void BiffObjectBase::dumpRectWithGaps( const String& rName, sal_Int32 nGap, + const NameListWrapper& rListWrp, FormatType eFmtType ) +{ + Type nLeft, nTop, nWidth, nHeight; + *mxBiffStrm >> nLeft; + mxBiffStrm->skip( nGap ); + *mxBiffStrm >> nTop; + mxBiffStrm->skip( nGap ); + *mxBiffStrm >> nWidth; + mxBiffStrm->skip( nGap ); + *mxBiffStrm >> nHeight; + mxBiffStrm->skip( nGap ); + writeRectItem( rName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType ); +} + // ============================================================================ // ============================================================================ @@ -460,6 +481,11 @@ private: void dumpObjRecFmla( const String& rName, sal_uInt16 nFmlaSize ); void dumpObjRecPictFmla( sal_uInt16 nFmlaSize ); + typedef ::std::pair< sal_uInt8, ::rtl::OUString > ChFrExtPropInfo; + + void dumpChFrExtProps(); + ChFrExtPropInfo dumpChFrExtPropHeader(); + private: NameListRef mxColors; NameListRef mxBorderStyles; diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx index b4f36c113c3d..10c62aa17513 100644 --- a/oox/inc/oox/xls/biffhelper.hxx +++ b/oox/inc/oox/xls/biffhelper.hxx @@ -301,8 +301,15 @@ const sal_uInt16 BIFF_ID_CHFRAME = 0x1032; const sal_uInt16 BIFF_ID_CHFRAMEPOS = 0x104F; const sal_uInt16 BIFF_ID_CHFRBLOCKBEGIN = 0x0852; const sal_uInt16 BIFF_ID_CHFRBLOCKEND = 0x0853; +const sal_uInt16 BIFF_ID_CHFRCATEGORYPROPS = 0x0856; +const sal_uInt16 BIFF_ID_CHFREXTPROPS = 0x089E; +const sal_uInt16 BIFF_ID_CHFREXTPROPSCONT = 0x089F; const sal_uInt16 BIFF_ID_CHFRINFO = 0x0850; const sal_uInt16 BIFF_ID_CHFRLABELPROPS = 0x086B; +const sal_uInt16 BIFF_ID_CHFRLAYOUT = 0x089D; +const sal_uInt16 BIFF_ID_CHFRPLOTAREALAYOUT = 0x08A7; +const sal_uInt16 BIFF_ID_CHFRSHAPEPROPS = 0x08A4; +const sal_uInt16 BIFF_ID_CHFRTEXTPROPS = 0x08A5; const sal_uInt16 BIFF_ID_CHFRUNITPROPS = 0x0857; const sal_uInt16 BIFF_ID_CHFRWRAPPER = 0x0851; const sal_uInt16 BIFF_ID_CHLABELRANGE = 0x1020; diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 3ad1c0023ebe..77cf21698c62 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -301,11 +301,12 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // axis title --------------------------------------------------------- - if( mrModel.mxTitle.is() ) + // in radar charts, title objects may exist, but are not shown + if( mrModel.mxTitle.is() && (rTypeGroup.getTypeInfo().meTypeCategory != TYPECATEGORY_RADAR) ) { Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW ); TitleConverter aTitleConv( *this, *mrModel.mxTitle ); - aTitleConv.convertFromModel( xTitled, CREATE_OUSTRING( "Axis Title" ), OBJECTTYPE_AXISTITLE ); + aTitleConv.convertFromModel( xTitled, CREATE_OUSTRING( "Axis Title" ), OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx ); } } catch( Exception& ) diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx b/oox/source/drawingml/chart/chartcontextbase.cxx index 2666d22ccbe0..d3746f07ba6c 100644 --- a/oox/source/drawingml/chart/chartcontextbase.cxx +++ b/oox/source/drawingml/chart/chartcontextbase.cxx @@ -27,6 +27,7 @@ #include "oox/drawingml/chart/chartcontextbase.hxx" #include "oox/drawingml/shapepropertiescontext.hxx" +#include "oox/drawingml/chart/modelbase.hxx" using ::oox::core::ContextHandler2Helper; using ::oox::core::ContextHandlerRef; @@ -53,6 +54,66 @@ ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, co // ============================================================================ +LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : + ContextBase< LayoutModel >( rParent, rModel ) +{ +} + +LayoutContext::~LayoutContext() +{ +} + +ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) +{ + switch( getCurrentElement() ) + { + case C_TOKEN( layout ): + switch( nElement ) + { + case C_TOKEN( manualLayout ): + mrModel.mbAutoLayout = false; + return this; + } + break; + + case C_TOKEN( manualLayout ): + switch( nElement ) + { + case C_TOKEN( x ): + mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( y ): + mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( w ): + mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( h ): + mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( xMode ): + mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( yMode ): + mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( wMode ): + mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( hMode ): + mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( layoutTarget ): + mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); + return 0; + } + break; + } + return 0; +} + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 6460e94a4f3b..54212f1bdbda 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -26,12 +26,12 @@ ************************************************************************/ #include "oox/drawingml/chart/chartspaceconverter.hxx" -#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/chart/chartconverter.hxx" #include "oox/drawingml/chart/chartdrawingfragment.hxx" @@ -147,14 +147,23 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern aDiaProp.setProperty( PROP_MissingValueTreatment, nMissingValues ); } - Reference< com::sun::star::chart::XChartDocument > xOldChartDoc( getChartDocument(), UNO_QUERY ); - if( xOldChartDoc.is() ) + /* Following all conversions needing the old Chart1 API that involves full + initialization of the chart view. */ + namespace cssc = ::com::sun::star::chart; + Reference< cssc::XChartDocument > xChart1Doc( getChartDocument(), UNO_QUERY ); + if( xChart1Doc.is() ) { /* Set the IncludeHiddenCells property via the old API as only this ensures that the data provider and all created sequences get this flag correctly. */ - PropertySet aOldDiaProp( xOldChartDoc->getDiagram() ); - aOldDiaProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); + PropertySet aDiaProp( xChart1Doc->getDiagram() ); + aDiaProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); + + // plot area position and size + aPlotAreaConv.convertPositionFromModel(); + + // positions of main title and all axis titles + convertTitlePositions(); } // embedded drawing shapes diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 534ce48e0278..b5a0511bf1b8 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -30,6 +30,14 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/chart/XAxisXSupplier.hpp> +#include <com/sun/star/chart/XAxisYSupplier.hpp> +#include <com/sun/star/chart/XAxisZSupplier.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> +#include <com/sun/star/chart2/RelativePosition.hpp> +#include <tools/solar.h> // for F_PI180 +#include "properties.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/theme.hxx" @@ -37,22 +45,126 @@ using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::frame::XModel; +using ::com::sun::star::awt::Point; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::awt::Size; +using ::com::sun::star::chart2::RelativePosition; using ::com::sun::star::chart2::XChartDocument; +using ::com::sun::star::chart2::XTitle; +using ::com::sun::star::drawing::XShape; using ::oox::core::XmlFilterBase; +namespace cssc = ::com::sun::star::chart; + namespace oox { namespace drawingml { namespace chart { // ============================================================================ +namespace { + +struct TitleKey : public ::std::pair< ObjectType, ::std::pair< sal_Int32, sal_Int32 > > +{ + inline explicit TitleKey( ObjectType eObjType, sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ) + { first = eObjType; second.first = nMainIdx; second.second = nSubIdx; } +}; + +// ---------------------------------------------------------------------------- + +/** A helper structure to store all data related to title objects. Needed for + the conversion of manual title positions that needs the old Chart1 API. + */ +struct TitleLayoutInfo +{ + typedef Reference< XShape > (*GetShapeFunc)( const Reference< cssc::XChartDocument >& ); + + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > + mxTitle; /// The API title object. + ModelRef< LayoutModel > mxLayout; /// The layout model, if existing. + GetShapeFunc mpGetShape; /// Helper function to receive the title shape. + + inline explicit TitleLayoutInfo() : mpGetShape( 0 ) {} + + void convertTitlePos( + ConverterRoot& rRoot, + const Reference< cssc::XChartDocument >& rxChart1Doc ); +}; + +void TitleLayoutInfo::convertTitlePos( ConverterRoot& rRoot, const Reference< cssc::XChartDocument >& rxChart1Doc ) +{ + if( mxTitle.is() && mpGetShape ) try + { + // try to get the title shape + Reference< XShape > xTitleShape( mpGetShape( rxChart1Doc ), UNO_SET_THROW ); + // get title rotation angle, needed for correction of position of top-left edge + double fAngle = 0.0; + PropertySet aTitleProp( mxTitle ); + aTitleProp.getProperty( fAngle, PROP_TextRotation ); + // convert the position + LayoutModel& rLayout = mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( rRoot, rLayout ); + aLayoutConv.convertFromModel( xTitleShape, fAngle ); + } + catch( Exception& ) + { + } +} + +// ---------------------------------------------------------------------------- + +/* The following local functions implement getting the XShape interface of all + supported title objects (chart and axes). This needs some effort due to the + design of the old Chart1 API used to access these objects. */ + +/** A code fragment that returns a shape object from the passed shape supplier + using the specified interface function. Checks a boolean property first. */ +#define OOX_FRAGMENT_GETTITLESHAPE( shape_supplier, supplier_func, property_name ) \ + PropertySet aPropSet( shape_supplier ); \ + if( shape_supplier.is() && aPropSet.getBoolProperty( PROP_##property_name ) ) \ + return shape_supplier->supplier_func(); \ + return Reference< XShape >(); \ + +/** Implements a function returning the drawing shape of an axis title, if + existing, using the specified API interface and its function. */ +#define OOX_DEFINEFUNC_GETAXISTITLESHAPE( func_name, interface_type, supplier_func, property_name ) \ +Reference< XShape > func_name( const Reference< cssc::XChartDocument >& rxChart1Doc ) \ +{ \ + Reference< cssc::interface_type > xAxisSupp( rxChart1Doc->getDiagram(), UNO_QUERY ); \ + OOX_FRAGMENT_GETTITLESHAPE( xAxisSupp, supplier_func, property_name ) \ +} + +/** Returns the drawing shape of the main title, if existing. */ +Reference< XShape > lclGetMainTitleShape( const Reference< cssc::XChartDocument >& rxChart1Doc ) +{ + OOX_FRAGMENT_GETTITLESHAPE( rxChart1Doc, getTitle, HasMainTitle ) +} + +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetXAxisTitleShape, XAxisXSupplier, getXAxisTitle, HasXAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetYAxisTitleShape, XAxisYSupplier, getYAxisTitle, HasYAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetZAxisTitleShape, XAxisZSupplier, getZAxisTitle, HasZAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetSecXAxisTitleShape, XSecondAxisTitleSupplier, getSecondXAxisTitle, HasSecondaryXAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetSecYAxisTitleShape, XSecondAxisTitleSupplier, getSecondYAxisTitle, HasSecondaryYAxisTitle ) + +#undef OOX_DEFINEFUNC_GETAXISTITLESHAPE +#undef OOX_IMPLEMENT_GETTITLESHAPE + +} // namespace + +// ============================================================================ + struct ConverterData { + typedef ::std::map< TitleKey, TitleLayoutInfo > TitleMap; + ObjectFormatter maFormatter; + TitleMap maTitles; XmlFilterBase& mrFilter; ChartConverter& mrConverter; Reference< XChartDocument > mxDoc; @@ -91,6 +203,14 @@ ConverterData::ConverterData( catch( Exception& ) { } + + // prepare conversion of title positions + maTitles[ TitleKey( OBJECTTYPE_CHARTTITLE ) ].mpGetShape = lclGetMainTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_PRIM_AXESSET, API_X_AXIS ) ].mpGetShape = lclGetXAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_PRIM_AXESSET, API_Y_AXIS ) ].mpGetShape = lclGetYAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_PRIM_AXESSET, API_Z_AXIS ) ].mpGetShape = lclGetZAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_SECN_AXESSET, API_X_AXIS ) ].mpGetShape = lclGetSecXAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_SECN_AXESSET, API_Y_AXIS ) ].mpGetShape = lclGetSecYAxisTitleShape; } ConverterData::~ConverterData() @@ -122,13 +242,12 @@ ConverterRoot::~ConverterRoot() { } -Reference< XInterface > ConverterRoot::createInstance( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rServiceName ) +Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const { Reference< XInterface > xInt; - if( rxFactory.is() ) try + try { - xInt = rxFactory->createInstance( rServiceName ); + xInt = mxData->mrFilter.getGlobalFactory()->createInstance( rServiceName ); } catch( Exception& ) { @@ -137,11 +256,6 @@ Reference< XInterface > ConverterRoot::createInstance( return xInt; } -Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const -{ - return createInstance( mxData->mrFilter.getGlobalFactory(), rServiceName ); -} - XmlFilterBase& ConverterRoot::getFilter() const { return mxData->mrFilter; @@ -167,6 +281,139 @@ ObjectFormatter& ConverterRoot::getFormatter() const return mxData->maFormatter; } +void ConverterRoot::registerTitleLayout( const Reference< XTitle >& rxTitle, + const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType, sal_Int32 nMainIdx, sal_Int32 nSubIdx ) +{ + OSL_ENSURE( rxTitle.is(), "ConverterRoot::registerTitleLayout - missing title object" ); + TitleLayoutInfo& rTitleInfo = mxData->maTitles[ TitleKey( eObjType, nMainIdx, nSubIdx ) ]; + OSL_ENSURE( rTitleInfo.mpGetShape, "ConverterRoot::registerTitleLayout - invalid title key" ); + rTitleInfo.mxTitle = rxTitle; + rTitleInfo.mxLayout = rxLayout; +} + +void ConverterRoot::convertTitlePositions() +{ + try + { + Reference< cssc::XChartDocument > xChart1Doc( mxData->mxDoc, UNO_QUERY_THROW ); + for( ConverterData::TitleMap::iterator aIt = mxData->maTitles.begin(), aEnd = mxData->maTitles.end(); aIt != aEnd; ++aIt ) + aIt->second.convertTitlePos( *this, xChart1Doc ); + } + catch( Exception& ) + { + } +} + +// ============================================================================ + +namespace { + +/** Returns a position value in the chart area in 1/100 mm. */ +sal_Int32 lclCalcPosition( sal_Int32 nChartSize, double fPos, sal_Int32 nPosMode ) +{ + switch( nPosMode ) + { + case XML_edge: // absolute start position as factor of chart size + return getLimitedValue< sal_Int32, double >( nChartSize * fPos + 0.5, 0, nChartSize ); + case XML_factor: // position relative to object default position + OSL_ENSURE( false, "lclCalcPosition - relative positioning not supported" ); + return -1; + }; + + OSL_ENSURE( false, "lclCalcPosition - unknown positioning mode" ); + return -1; +} + +/** Returns a size value in the chart area in 1/100 mm. */ +sal_Int32 lclCalcSize( sal_Int32 nPos, sal_Int32 nChartSize, double fSize, sal_Int32 nSizeMode ) +{ + sal_Int32 nValue = getLimitedValue< sal_Int32, double >( nChartSize * fSize + 0.5, 0, nChartSize ); + switch( nSizeMode ) + { + case XML_factor: // size as factor of chart size + return nValue; + case XML_edge: // absolute end position as factor of chart size + return nValue - nPos + 1; + }; + + OSL_ENSURE( false, "lclCalcSize - unknown size mode" ); + return -1; +} + +} // namespace + +// ---------------------------------------------------------------------------- + +LayoutConverter::LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ) : + ConverterBase< LayoutModel >( rParent, rModel ) +{ +} + +LayoutConverter::~LayoutConverter() +{ +} + +bool LayoutConverter::calcAbsRectangle( Rectangle& orRect ) const +{ + if( !mrModel.mbAutoLayout ) + { + const Size& rChartSize = getChartSize(); + orRect.X = lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ); + orRect.Y = lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ); + if( (orRect.X >= 0) && (orRect.Y >= 0) ) + { + orRect.Width = lclCalcSize( orRect.X, rChartSize.Width, mrModel.mfW, mrModel.mnWMode ); + orRect.Height = lclCalcSize( orRect.Y, rChartSize.Height, mrModel.mfH, mrModel.mnHMode ); + return (orRect.Width > 0) && (orRect.Height > 0); + } + } + return false; +} + +bool LayoutConverter::convertFromModel( PropertySet& rPropSet ) +{ + if( !mrModel.mbAutoLayout && + (mrModel.mnXMode == XML_edge) && (mrModel.mfX >= 0.0) && + (mrModel.mnYMode == XML_edge) && (mrModel.mfY >= 0.0) ) + { + RelativePosition aPos; + aPos.Primary = getLimitedValue< double, double >( mrModel.mfX, 0.0, 1.0 ); + aPos.Secondary = getLimitedValue< double, double >( mrModel.mfY, 0.0, 1.0 ); + aPos.Anchor = ::com::sun::star::drawing::Alignment_TOP_LEFT; + rPropSet.setProperty( PROP_RelativePosition, aPos ); + return true; + } + return false; +} + +bool LayoutConverter::convertFromModel( const Reference< XShape >& rxShape, double fRotationAngle ) +{ + if( !mrModel.mbAutoLayout ) + { + const Size& rChartSize = getChartSize(); + Point aShapePos( + lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ), + lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ) ); + if( (aShapePos.X >= 0) && (aShapePos.Y >= 0) ) + { + // the call to XShape.getSize() may recalc the chart view + Size aShapeSize = rxShape->getSize(); + // rotated shapes need special handling... + double fSin = fabs( sin( fRotationAngle * F_PI180 ) ); + // add part of height to X direction, if title is rotated down + if( fRotationAngle > 180.0 ) + aShapePos.X += static_cast< sal_Int32 >( fSin * aShapeSize.Height + 0.5 ); + // add part of width to Y direction, if title is rotated up + else if( fRotationAngle > 0.0 ) + aShapePos.Y += static_cast< sal_Int32 >( fSin * aShapeSize.Width + 0.5 ); + // set the resulting position at the shape + rxShape->setPosition( aShapePos ); + return true; + } + } + return false; +} + // ============================================================================ } // namespace chart diff --git a/oox/source/drawingml/chart/modelbase.cxx b/oox/source/drawingml/chart/modelbase.cxx index 3aa6b1f0047f..c182d8e3e410 100644 --- a/oox/source/drawingml/chart/modelbase.cxx +++ b/oox/source/drawingml/chart/modelbase.cxx @@ -50,6 +50,26 @@ void NumberFormat::setAttributes( const AttributeList& rAttribs ) // ============================================================================ +LayoutModel::LayoutModel() : + mfX( 0.0 ), + mfY( 0.0 ), + mfW( 0.0 ), + mfH( 0.0 ), + mnXMode( XML_factor ), + mnYMode( XML_factor ), + mnWMode( XML_factor ), + mnHMode( XML_factor ), + mnTarget( XML_outer ), + mbAutoLayout( true ) +{ +} + +LayoutModel::~LayoutModel() +{ +} + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 5b898d4da6ed..d96e2d43dd6f 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1142,18 +1142,19 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef { if( rxTextProp.is() ) { - /* Chart2 expects rotation angle as double value in range of [0,360). - OOXML counts clockwise, Chart2 counts counterclockwise. */ - double fAngle = rxTextProp->getTextProperties().moRotation.get( 0 ); - fAngle = getDoubleIntervalValue< double >( -fAngle / 60000.0, 0.0, 360.0 ); - rPropSet.setProperty( PROP_TextRotation, fAngle ); - + bool bStacked = false; if( bSupportsStacked ) { sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz ); - bool bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); + bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); rPropSet.setProperty( PROP_StackCharacters, bStacked ); } + + /* Chart2 expects rotation angle as double value in range of [0,360). + OOXML counts clockwise, Chart2 counts counterclockwise. */ + double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( 0 ) ); + fAngle = getDoubleIntervalValue< double >( -fAngle / 60000.0, 0.0, 360.0 ); + rPropSet.setProperty( PROP_TextRotation, fAngle ); } } @@ -1195,12 +1196,12 @@ void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eO pFormat->convertAutomaticFill( rPropSet, nSeriesIdx ); } -bool ObjectFormatter::isAutomaticLine( const ModelRef< Shape >& rxShapeProp ) +/*static*/ bool ObjectFormatter::isAutomaticLine( const ModelRef< Shape >& rxShapeProp ) { return !rxShapeProp || !rxShapeProp->getLineProperties().maLineFill.moFillType.has(); } -bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) +/*static*/ bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) { return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has(); } diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index f69fde409c0e..c3f74899ed97 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -29,6 +29,8 @@ #include <com/sun/star/drawing/Direction3D.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/XDiagram.hpp> @@ -42,6 +44,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::chart2::XCoordinateSystem; using ::com::sun::star::chart2::XCoordinateSystemContainer; using ::com::sun::star::chart2::XDiagram; @@ -54,14 +57,15 @@ namespace chart { namespace { -/** Axes set model. This is a helper class for the plot area converter. */ +/** Axes set model. This is a helper for the plot area converter collecting all + type groups and axes of the primary or secondary axes set. */ struct AxesSetModel { typedef ModelVector< TypeGroupModel > TypeGroupVector; typedef ModelMap< sal_Int32, AxisModel > AxisMap; - TypeGroupVector maTypeGroups; - AxisMap maAxes; + TypeGroupVector maTypeGroups; /// All type groups containing data series. + AxisMap maAxes; /// All axes mapped by API axis type. inline explicit AxesSetModel() {} inline ~AxesSetModel() {} @@ -90,11 +94,14 @@ public: inline bool is3dChart() const { return mb3dChart; } /** Returns true, if chart type supports wall and floor format in 3D mode. */ inline bool isWall3dChart() const { return mbWall3dChart; } + /** Returns true, if chart is a pie chart or doughnut chart. */ + inline bool isPieChart() const { return mbPieChart; } private: ::rtl::OUString maAutoTitle; bool mb3dChart; bool mbWall3dChart; + bool mbPieChart; }; // ---------------------------------------------------------------------------- @@ -102,7 +109,8 @@ private: AxesSetConverter::AxesSetConverter( const ConverterRoot& rParent, AxesSetModel& rModel ) : ConverterBase< AxesSetModel >( rParent, rModel ), mb3dChart( false ), - mbWall3dChart( false ) + mbWall3dChart( false ), + mbPieChart( false ) { } @@ -159,6 +167,7 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, // 3D view settings mb3dChart = rFirstTypeGroup.is3dChart(); mbWall3dChart = rFirstTypeGroup.isWall3dChart(); + mbPieChart = rFirstTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE; if( mb3dChart ) { View3DConverter aView3DConv( *this, rView3DModel ); @@ -305,7 +314,8 @@ void WallFloorConverter::convertFromModel( const Reference< XDiagram >& rxDiagra PlotAreaConverter::PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel ) : ConverterBase< PlotAreaModel >( rParent, rModel ), mb3dChart( false ), - mbWall3dChart( false ) + mbWall3dChart( false ), + mbPieChart( false ) { } @@ -392,6 +402,7 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) maAutoTitle = aAxesSetConv.getAutomaticTitle(); mb3dChart = aAxesSetConv.is3dChart(); mbWall3dChart = aAxesSetConv.isWall3dChart(); + mbPieChart = aAxesSetConv.isPieChart(); } else { @@ -407,6 +418,35 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) } } +void PlotAreaConverter::convertPositionFromModel() +{ + LayoutModel& rLayout = mrModel.mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( *this, rLayout ); + Rectangle aDiagramRect; + if( aLayoutConv.calcAbsRectangle( aDiagramRect ) ) try + { + namespace cssc = ::com::sun::star::chart; + Reference< cssc::XChartDocument > xChart1Doc( getChartDocument(), UNO_QUERY_THROW ); + Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW ); + // for pie charts, always set inner plot area size to exclude the data labels as Excel does + sal_Int32 nTarget = (mbPieChart && (rLayout.mnTarget == XML_outer)) ? XML_inner : rLayout.mnTarget; + switch( nTarget ) + { + case XML_inner: + xPositioning->setDiagramPositionExcludingAxes( aDiagramRect ); + break; + case XML_outer: + xPositioning->setDiagramPositionIncludingAxes( aDiagramRect ); + break; + default: + OSL_ENSURE( false, "PlotAreaConverter::convertPositionFromModel - unknown positioning target" ); + } + } + catch( Exception& ) + { + } +} + // ============================================================================ } // namespace chart diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index a4cf7c1f3eb2..717a3972550e 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -344,6 +344,23 @@ Reference< XLabeledDataSequence > ErrorBarConverter::createLabeledDataSequence( // ============================================================================ +TrendlineLabelConverter::TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ) : + ConverterBase< TrendlineLabelModel >( rParent, rModel ) +{ +} + +TrendlineLabelConverter::~TrendlineLabelConverter() +{ +} + +void TrendlineLabelConverter::convertFromModel( PropertySet& rPropSet ) +{ + // formatting + getFormatter().convertFormatting( rPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_TRENDLINELABEL ); +} + +// ============================================================================ + TrendlineConverter::TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel ) : ConverterBase< TrendlineModel >( rParent, rModel ) { @@ -385,8 +402,8 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat // #i83100# formatting of the equation text box if( mrModel.mbDispEquation || mrModel.mbDispRSquared ) { - TrendlineLabelModel& rLabel = mrModel.mxLabel.getOrCreate(); - getFormatter().convertFormatting( aLabelProp, rLabel.mxShapeProp, rLabel.mxTextProp, OBJECTTYPE_TRENDLINELABEL ); + TrendlineLabelConverter aLabelConv( *this, mrModel.mxLabel.getOrCreate() ); + aLabelConv.convertFromModel( aLabelProp ); } // unsupported: #i5085# manual trendline size diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx index e9007e4d53d7..963ccdad595a 100644 --- a/oox/source/drawingml/chart/titlecontext.cxx +++ b/oox/source/drawingml/chart/titlecontext.cxx @@ -41,65 +41,6 @@ namespace chart { // ============================================================================ -LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : - ContextBase< LayoutModel >( rParent, rModel ) -{ -} - -LayoutContext::~LayoutContext() -{ -} - -ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) -{ - switch( getCurrentElement() ) - { - case C_TOKEN( layout ): - switch( nElement ) - { - case C_TOKEN( manualLayout ): - return this; - } - break; - - case C_TOKEN( manualLayout ): - switch( nElement ) - { - case C_TOKEN( x ): - mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( y ): - mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( w ): - mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( h ): - mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( xMode ): - mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( yMode ): - mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( wMode ): - mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( hMode ): - mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( layoutTarget ): - mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); - return 0; - } - break; - } - return 0; -} - -// ============================================================================ - TextContext::TextContext( ContextHandler2Helper& rParent, TextModel& rModel ) : ContextBase< TextModel >( rParent, rModel ) { diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index 6316ee5f7ee4..bca53f1a2c01 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -26,11 +26,14 @@ ************************************************************************/ #include "oox/drawingml/chart/titleconverter.hxx" +#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XFormattedString.hpp> #include <com/sun/star/chart2/XLegend.hpp> #include <com/sun/star/chart2/XTitle.hpp> #include <com/sun/star/chart2/XTitled.hpp> +#include "properties.hxx" #include "oox/drawingml/textbody.hxx" #include "oox/drawingml/textparagraph.hxx" #include "oox/drawingml/chart/datasourceconverter.hxx" @@ -41,6 +44,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::chart2::XDiagram; using ::com::sun::star::chart2::XFormattedString; using ::com::sun::star::chart2::XLegend; @@ -149,7 +153,7 @@ TitleConverter::~TitleConverter() { } -void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, const OUString& rAutoTitle, ObjectType eObjType ) +void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, const OUString& rAutoTitle, ObjectType eObjType, sal_Int32 nMainIdx, sal_Int32 nSubIdx ) { if( rxTitled.is() ) { @@ -172,6 +176,9 @@ void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, con OSL_ENSURE( !mrModel.mxTextProp || !rText.mxTextBody, "TitleConverter::convertFromModel - multiple text properties" ); ModelRef< TextBody > xTextProp = mrModel.mxTextProp.is() ? mrModel.mxTextProp : rText.mxTextBody; getFormatter().convertTextRotation( aPropSet, xTextProp, true ); + + // register the title and layout data for conversion of position + registerTitleLayout( xTitle, mrModel.mxLayout, eObjType, nMainIdx, nSubIdx ); } catch( Exception& ) { @@ -194,13 +201,64 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) { if( rxDiagram.is() ) try { + namespace cssc2 = ::com::sun::star::chart2; + // create the legend Reference< XLegend > xLegend( createInstance( CREATE_OUSTRING( "com.sun.star.chart2.Legend" ) ), UNO_QUERY_THROW ); rxDiagram->setLegend( xLegend ); + PropertySet aPropSet( xLegend ); + aPropSet.setProperty( PROP_Show, true ); // legend formatting - PropertySet aPropSet( xLegend ); getFormatter().convertFormatting( aPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_LEGEND ); + + // predefined legend position and expansion + cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM; + cssc2::LegendExpansion eLegendExpand = cssc2::LegendExpansion_HIGH; + switch( mrModel.mnPosition ) + { + case XML_l: + eLegendPos = cssc2::LegendPosition_LINE_START; + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + case XML_r: + eLegendPos = cssc2::LegendPosition_LINE_END; + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + case XML_t: + eLegendPos = cssc2::LegendPosition_PAGE_START; + eLegendExpand = cssc2::LegendExpansion_WIDE; + break; + case XML_b: + eLegendPos = cssc2::LegendPosition_PAGE_END; + eLegendExpand = cssc2::LegendExpansion_WIDE; + break; + case XML_tr: + eLegendPos = cssc2::LegendPosition_LINE_END; // top-right not supported + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + } + + // manual positioning + LayoutModel& rLayout = mrModel.mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( *this, rLayout ); + aLayoutConv.convertFromModel( aPropSet ); + Rectangle aLegendRect; + if( aLayoutConv.calcAbsRectangle( aLegendRect ) ) + { + // #i71697# it is not possible to set the size directly, do some magic here + double fRatio = static_cast< double >( aLegendRect.Width ) / aLegendRect.Height; + if( fRatio > 1.5 ) + eLegendExpand = cssc2::LegendExpansion_WIDE; + else if( fRatio < 0.75 ) + eLegendExpand = cssc2::LegendExpansion_HIGH; + else + eLegendExpand = cssc2::LegendExpansion_BALANCED; + } + + // set position and expansion properties + aPropSet.setProperty( PROP_AnchorPosition, eLegendPos ); + aPropSet.setProperty( PROP_Expansion, eLegendExpand ); } catch( Exception& ) { diff --git a/oox/source/drawingml/chart/titlemodel.cxx b/oox/source/drawingml/chart/titlemodel.cxx index 51c51a62c4b7..bb5501e05f32 100644 --- a/oox/source/drawingml/chart/titlemodel.cxx +++ b/oox/source/drawingml/chart/titlemodel.cxx @@ -33,25 +33,6 @@ namespace chart { // ============================================================================ -LayoutModel::LayoutModel() : - mfX( 0.0 ), - mfY( 0.0 ), - mfW( 0.0 ), - mfH( 0.0 ), - mnXMode( XML_factor ), - mnYMode( XML_factor ), - mnWMode( XML_factor ), - mnHMode( XML_factor ), - mnTarget( XML_outer ) -{ -} - -LayoutModel::~LayoutModel() -{ -} - -// ============================================================================ - TextModel::TextModel() { } diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index ea1944d935a4..aa32cbe53d1b 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -1697,7 +1697,7 @@ void WorkbookStreamObject::implDumpRecordBody() case BIFF_ID_CHAXESSET: dumpDec< sal_uInt16 >( "axesset-id", "CHAXESSET-ID" ); - dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); + dumpRect< sal_Int32 >( "inner-plotarea-pos", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); break; case BIFF_ID_CHAXIS: @@ -1728,11 +1728,6 @@ void WorkbookStreamObject::implDumpRecordBody() dumpHex< sal_uInt16 >( "flags", "CHCHART3D-FLAGS" ); break; - case BIFF_ID_CHECKCOMPAT: - dumpFrHeader( true, true ); - dumpBool< sal_uInt32 >( "check-compatibility" ); - break; - case BIFF_ID_CHDATAFORMAT: dumpDec< sal_Int16 >( "point-idx", "CHDATAFORMAT-POINTIDX" ); dumpDec< sal_Int16 >( "series-idx" ); @@ -1740,6 +1735,11 @@ void WorkbookStreamObject::implDumpRecordBody() if( eBiff >= BIFF5 ) dumpHex< sal_uInt16 >( "flags", "CHDATAFORMAT-FLAGS" ); break; + case BIFF_ID_CHECKCOMPAT: + dumpFrHeader( true, true ); + dumpBool< sal_uInt32 >( "check-compatibility" ); + break; + case BIFF_ID_CHESCHERFORMAT: dumpEmbeddedDff(); break; @@ -1750,9 +1750,9 @@ void WorkbookStreamObject::implDumpRecordBody() break; case BIFF_ID_CHFRAMEPOS: - dumpDec< sal_uInt16 >( "object-type", "CHFRAMEPOS-OBJTYPE" ); - dumpDec< sal_uInt16 >( "size-mode", "CHFRAMEPOS-SIZEMODE" ); - dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); + dumpDec< sal_uInt16 >( "tl-mode", "CHFRAMEPOS-POSMODE" ); + dumpDec< sal_uInt16 >( "br-mode", "CHFRAMEPOS-POSMODE" ); + dumpRectWithGaps< sal_Int16 >( "position", 2 ); break; case BIFF_ID_CHFRBLOCKBEGIN: @@ -1770,6 +1770,25 @@ void WorkbookStreamObject::implDumpRecordBody() dumpUnused( 6 ); break; + case BIFF_ID_CHFRCATEGORYPROPS: + dumpFrHeader( true, false ); + dumpDec< sal_uInt16 >( "label-offset", "CONV-PERCENT" ); + dumpDec< sal_uInt16 >( "alignment", "CHFRCATEGORYPROPS-ALIGN" ); + dumpHex< sal_uInt16 >( "flags", "CHFRCATEGORYPROPS-FLAGS" ); + break; + + case BIFF_ID_CHFREXTPROPS: + { + dumpFrHeader( true, true ); + dumpDec< sal_uInt32 >( "data-size" ); + dumpDec< sal_uInt8 >( "version" ); + dumpUnused( 1 ); + dumpDec< sal_uInt16 >( "parent", "CHFREXTPROPS-PARENT" ); + dumpChFrExtProps(); + dumpUnused( 4 ); + } + break; + case BIFF_ID_CHFRINFO: { dumpFrHeader( true, false ); @@ -1788,6 +1807,45 @@ void WorkbookStreamObject::implDumpRecordBody() dumpUniString( "separator", BIFF_STR_SMARTFLAGS ); break; + case BIFF_ID_CHFRLAYOUT: + dumpFrHeader( true, true ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpHex< sal_uInt16 >( "flags", "CHFRLAYOUT-FLAGS" ); + dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" ); + dumpRect< double >( "position" ); + dumpUnused( 2 ); + break; + + case BIFF_ID_CHFRPLOTAREALAYOUT: + dumpFrHeader( true, true ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpHex< sal_uInt16 >( "flags", "CHFRPLOTAREALAYOUT-FLAGS" ); + dumpRect< sal_Int16 >( "position" ); + dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" ); + dumpRect< double >( "position" ); + dumpUnused( 2 ); + break; + + case BIFF_ID_CHFRSHAPEPROPS: + dumpFrHeader( true, true ); + dumpDec< sal_uInt16 >( "context" ); + dumpUnused( 2 ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpDec< sal_uInt32 >( "xml-size" ); + break; + + case BIFF_ID_CHFRTEXTPROPS: + dumpFrHeader( true, true ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpDec< sal_uInt32 >( "xml-size" ); + break; + case BIFF_ID_CHFRUNITPROPS: dumpFrHeader( true, false ); dumpDec< sal_Int16 >( "preset", "CHFRUNITPROPS-PRESET" ); @@ -1941,9 +1999,9 @@ void WorkbookStreamObject::implDumpRecordBody() dumpDec< sal_uInt16 >( "fill-mode", "CHTEXT-FILLMODE" ); dumpColorABGR(); dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); - dumpHex< sal_uInt16 >( "flags", "CHTEXT-FLAGS" ); + dumpHex< sal_uInt16 >( "flags-1", "CHTEXT-FLAGS1" ); if( eBiff == BIFF8 ) dumpColorIdx(); - if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "placement", "CHTEXT-PLACEMENT" ); + if( eBiff == BIFF8 ) dumpHex< sal_uInt16 >( "flags-2", "CHTEXT-FLAGS2" ); if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "rotation", "TEXTROTATION" ); break; @@ -4116,6 +4174,56 @@ void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize ) } } +void WorkbookStreamObject::dumpChFrExtProps() +{ + BiffInputStream& rStrm = getBiffStream(); + bool bValid = true; + while( bValid && (rStrm.getRemaining() > 4) ) + { + ChFrExtPropInfo aInfo = dumpChFrExtPropHeader(); + IndentGuard aIndGuard( mxOut ); + switch( aInfo.first ) + { + case 0: // start + case 1: // end + break; + case 2: // bool + dumpBoolean( "value" ); + dumpUnused( 1 ); + break; + case 3: // double + dumpUnused( 4 ); + dumpDec< double >( "value", aInfo.second ); + break; + case 4: // int32 + dumpDec< sal_Int32 >( "value", aInfo.second ); + break; + case 5: // string + dumpUnicodeArray( "value", rStrm.readInt32() ); + break; + case 6: // uint16 + dumpDec< sal_uInt16 >( "value", aInfo.second ); + break; + case 7: // blob + dumpBinary( "value", rStrm.readuInt32() ); + break; + default: + bValid = false; + } + } +} + +WorkbookStreamObject::ChFrExtPropInfo WorkbookStreamObject::dumpChFrExtPropHeader() +{ + MultiItemsGuard aMultiGuard( mxOut ); + ChFrExtPropInfo aInfo; + aInfo.first = dumpDec< sal_uInt8 >( "datatype", "CHFREXTPROPS-TYPE" ); + dumpUnused( 1 ); + sal_uInt16 nTag = dumpDec< sal_uInt16 >( "tag", "CHFREXTPROPS-TAG" ); + aInfo.second = cfg().getName( "CHFREXTPROPS-TAG-NAMELIST", nTag ); + return aInfo; +} + // ============================================================================ PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const ::rtl::OUString& rSysFileName ) diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 16c3fb883149..2d1f4bdf7897 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -293,7 +293,7 @@ end multilist=RECORD-NAMES-BIFF3 include=RECORD-NAMES-BIFF2 # worksheet records - exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0021,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045 + exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045 0x0050=,,,,,,BUILTINFMTCOUNT, 0x0058=TOOLBAR,XCT,CRN,FILESHARING,WRITEACCESS,OBJ,UNCALCED,SAFERECALC 0x0060=TEMPLATE,INTL,,OBJECTPROTECT,,,, @@ -383,16 +383,17 @@ multilist=RECORD-NAMES-BIFF8 0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,VBAPROJECTEMPTY,DATAVALIDATION, 0x01C0=XL9FILE,RECALCID,INTCACHEDDATA,,,,, + # future records 0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,, - 0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,,CHFRUNITPROPS + 0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,CHFRCATEGORYPROPS,CHFRUNITPROPS 0x0858=CHPIVOTREF,CHPIVOTFLAGS,,,,,, 0x0860=,,SHEETEXT,BOOKEXT,,,,SHAREDFEATHEAD 0x0868=,,,CHFRLABELPROPS,,,, 0x0878=,,CFRULE12,CFRULEEXT,XFCRC,XFEXT,, 0x0888=,,,PAGELAYOUTVIEW,CHECKCOMPAT,DXF,TABLESTYLES, 0x0890=,,STYLEEXT,,,,THEME, - 0x0898=,,MTHREADSETTINGS,COMPRESSPICS,HEADERFOOTER,,, - 0x08A0=,,,FORCEFULLCALC,,,, + 0x0898=,,MTHREADSETTINGS,COMPRESSPICS,HEADERFOOTER,CHFRLAYOUT,CHFREXTPROPS,CHFREXTPROPSCONT + 0x08A0=,,,FORCEFULLCALC,CHFRSHAPEPROPS,CHFRTEXTPROPS,,CHFRPLOTAREALAYOUT # chart records 0x1058=,,,,,,,CH3DDATAFORMAT 0x1060=CHFONTBASE,CHPIEEXT,CHLABELRANGE2,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT @@ -829,16 +830,104 @@ end # CHFRAMEPOS ----------------------------------------------------------------- -shortlist=CHFRAMEPOS-OBJTYPE,2,any,,,legend -shortlist=CHFRAMEPOS-SIZEMODE,1,manual,auto +shortlist=CHFRAMEPOS-POSMODE,0,rel-points,abssize-points,parent-dependent,offset-plotarea-size,,chartsize # CHFRBLOCKBEGIN, CHFRBLOCKEND ----------------------------------------------- shortlist=CHFRBLOCK-TYPE,0,axes-set,,text,,axis,type-group,data-table,frame,,legend,legend-exception,,series,chart,data-format,drop-bar +# CHFRCATEGORYPROPS ---------------------------------------------------------- + +shortlist=CHFRCATEGORYPROPS-ALIGN,1,top-left,center,bottom-right + +flagslist=CHFRCATEGORYPROPS-FLAGS + ignore=0xFFFE + 0x0001=auto-label-frequency +end + +# CHFREXTPROPS --------------------------------------------------------------- + +constlist=CHFREXTPROPS-PARENT + 0x0001=log-scaling + 0x0002=style + 0x0004=category-scaling + 0x0005=chart-props + 0x000F=legend + 0x0013=marker + 0x0016=plot-area + 0x0019=chart-title + 0x0037=3d-props +end + +constlist=CHFREXTPROPS-TYPE + 0=start + 1=end + 2=bool + 3=double + 4=int32 + 5=string + 6=uint16 + 7=blob +end + +constlist=CHFREXTPROPS-TAG + 0x0000=log-base + 0x0003=style + 0x001E=chart-formatting + 0x0020=text-formatting + 0x0022=symbol-type + 0x002E=no-multi-level + 0x002F=overlay + 0x0033=theme-override + 0x0034=color-mapping-override + 0x0035=backwall-thickness + 0x0036=floor-thickness + 0x004D=perspective + 0x004E=rotation-x + 0x004F=rotation-y + 0x0050=right-angled-axes-off + 0x0052=tick-mark-skip + 0x0051=tick-label-skip + 0x0053=major-unit + 0x0054=minor-unit + 0x0055=max + 0x0056=min + 0x0059=side-wall + 0x005B=show-data-labels-over-max + 0x005C=tick-label-pos + 0x005E=pie-combination + 0x005F=basetime-unit + 0x0064=format-code + 0x0065=height-percent + 0x0066=display-blanks-as + 0x006A=major-unit-type + 0x006B=minor-unit-type + 0x0076=edit-language +end + +constlist=CHFREXTPROPS-TAG-NAMELIST + default= + 0x0022=CHFREXTPROPS-SYMBOLTYPE + 0x0035=CONV-PERCENT + 0x0036=CONV-PERCENT + 0x004E=CONV-DEG + 0x004F=CONV-DEG + 0x005C=CHFREXTPROPS-TICKLABELPOS + 0x005F=CHFREXTPROPS-TIMEUNIT + 0x0065=CONV-PERCENT + 0x0066=CHFREXTPROPS-DISPBLANKSAS + 0x006A=CHFREXTPROPS-TIMEUNIT + 0x006B=CHFREXTPROPS-TIMEUNIT +end + +shortlist=CHFREXTPROPS-DISPBLANKSAS,0x0067,gap,,spanned +shortlist=CHFREXTPROPS-SYMBOLTYPE,0x0023,none,diamond,square,triangle,x,star,dot,dash,circle,plus +shortlist=CHFREXTPROPS-TICKLABELPOS,0x005D,center +shortlist=CHFREXTPROPS-TIMEUNIT,0x0060,days,months,years + # CHFRINFO ------------------------------------------------------------------- -shortlist=CHFRINFO-APPVERSION,9,excel-2000,excel-xp-2003,excel-2007 +shortlist=CHFRINFO-APPVERSION,9,excel-2000,excel-xp-2003,,excel-2007 # CHFRLABELPROPS ------------------------------------------------------------- @@ -850,6 +939,26 @@ flagslist=CHFRLABELPROPS-FLAGS 0x0010=show-bubble end +# CHFRLAYOUT ----------------------------------------------------------------- + +combilist=CHFRLAYOUT-FLAGS + 0x001E=uint8,dec,legend-pos,CHFRLAYOUT-LEGENDPOS +end + +shortlist=CHFRLAYOUT-LEGENDPOS,0,bottom,top-right,top,right,left + +shortlist=CHFRLAYOUT-MODE,0,auto,factor,egde + +# CHFRPLOTAREALAYOUT --------------------------------------------------------- + +flagslist=CHFRPLOTAREALAYOUT-FLAGS + 0x0001=!outer!inner +end + +shortlist=CHFRLAYOUT-LEGENDPOS,0,bottom,top-right,top,right,left + +shortlist=CHFRLAYOUT-MODE,0,auto,factor,egde + # CHFRUNITPROPS -------------------------------------------------------------- shortlist=CHFRUNITPROPS-PRESET,-1,manual,none,hundred,thousand,10000,100000,million,10-million,100-million,billion,trillion @@ -881,7 +990,7 @@ end # CHLEGEND ------------------------------------------------------------------- -shortlist=CHLEGEND-DOCKPOS,0,bottom,top-left,top,right,left,,,manual +shortlist=CHLEGEND-DOCKPOS,0,bottom,top-right,top,right,left,,,manual shortlist=CHLEGEND-SPACING,0,close,medium,open flagslist=CHLEGEND-FLAGS @@ -909,6 +1018,7 @@ shortlist=CHLINEFORMAT-LINEWEIGHT,-1,hair,thin,medium,thick flagslist=CHLINEFORMAT-FLAGS 0x0001=auto 0x0004=axis-enabled + 0x0008=system-color end # CHMARKERFORMAT ------------------------------------------------------------- @@ -1040,7 +1150,7 @@ shortlist=CHTEXT-HORALIGN,1,left,center,right,block,distribute shortlist=CHTEXT-VERALIGN,1,top,center,bottom,block,distribute shortlist=CHTEXT-FILLMODE,1,transparent,opaque -flagslist=CHTEXT-FLAGS-BIFF2 +flagslist=CHTEXT-FLAGS1-BIFF2 0x0001=auto-color 0x0002=show-symbol 0x0004=show-value @@ -1051,28 +1161,31 @@ flagslist=CHTEXT-FLAGS-BIFF2 0x0080=auto-fill end -combilist=CHTEXT-FLAGS-BIFF3 - include=CHTEXT-FLAGS-BIFF2 +combilist=CHTEXT-FLAGS1-BIFF3 + include=CHTEXT-FLAGS1-BIFF2 0x0700=uint8,dec,orientation,TEXTORIENTATION end -combilist=CHTEXT-FLAGS-BIFF5 - include=CHTEXT-FLAGS-BIFF3 +combilist=CHTEXT-FLAGS1-BIFF5 + include=CHTEXT-FLAGS1-BIFF3 0x0800=show-categ-percent 0x1000=show-percent end -combilist=CHTEXT-FLAGS-BIFF8 - include=CHTEXT-FLAGS-BIFF5 +combilist=CHTEXT-FLAGS1-BIFF8 + include=CHTEXT-FLAGS1-BIFF5 0x2000=show-bubble-size 0x4000=show-categ end -multilist=CHTEXT-PLACEMENT - default= - 0=context,outside,inside,center,axis,above,below,left,right,auto,manual +combilist=CHTEXT-FLAGS2 + ignore=0x3FF0 + 0x000F=uint8,dec,placement,CHTEXT-PLACEMENT + 0xC000=uint8,dec,text-dir,XF-TEXTDIRECTION end +shortlist=CHTEXT-PLACEMENT,0,context,outside,inside,center,axis,above,below,left,right,auto,manual + # CHTICK --------------------------------------------------------------------- shortlist=CHTICK-TYPE,0,none,inside,outside,both diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 203ce4552e5d..fddc13966798 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -6,6 +6,7 @@ Adjust AdjustContrast AdjustLuminance Align +AnchorPosition ArrangeOrder Aspect AttachedAxisIndex @@ -121,6 +122,7 @@ ErrorBarX ErrorBarY ErrorMessage ErrorTitle +Expansion ExternalDocLinks ExternalLinks FileFormat @@ -169,10 +171,16 @@ HasAutoShowInfo HasColumnRowHeaders HasHorizontalScrollBar HasLayoutInfo +HasMainTitle HasReference +HasSecondaryXAxisTitle +HasSecondaryYAxisTitle HasSheetTabs HasSortInfo HasVerticalScrollBar +HasXAxisTitle +HasYAxisTitle +HasZAxisTitle HeaderBodyDistance HeaderHeight HeaderIsDynamicHeight @@ -304,6 +312,7 @@ ReferenceDevice RegularExpressions RelId RelativeHorizontalTabbarWidth +RelativePosition Repeat RepeatDelay Representation diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index a4c0731b19ed..04fcd2f84648 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -909,7 +909,7 @@ void ExternalLink::insertExternalSheet( const OUString& rSheetName ) OSL_ENSURE( rSheetName.getLength() > 0, "ExternalLink::insertExternalSheet - empty sheet name" ); if( mxDocLink.is() ) { - Reference< XExternalSheetCache > xSheetCache = mxDocLink->addSheetCache( rSheetName ); + Reference< XExternalSheetCache > xSheetCache = mxDocLink->addSheetCache( rSheetName, false ); sal_Int32 nCacheIdx = xSheetCache.is() ? xSheetCache->getTokenIndex() : -1; maSheetCaches.push_back( nCacheIdx ); } diff --git a/openssl/makefile.mk b/openssl/makefile.mk index bfbff09d80fa..081680781a2c 100644 --- a/openssl/makefile.mk +++ b/openssl/makefile.mk @@ -62,15 +62,25 @@ OUT2LIB = libssl.* OUT2LIB += libcrypto.* OUT2INC += include/openssl/* +UNAME=$(shell uname) + .IF "$(OS)" == "LINUX" || "$(OS)" == "FREEBSD" PATCH_FILES=openssllnx.patch ADDITIONAL_FILES:= \ libcrypto_OOo_0_9_8l.map \ libssl_OOo_0_9_8l.map .IF "$(CPU)" == "I" - CONFIGURE_ACTION=Configure linux-elf + .IF "$(UNAME)" == "GNU/kFreeBSD" + CONFIGURE_ACTION=Configure debian-kfreebsd-i386 + .ELSE + CONFIGURE_ACTION=Configure linux-elf + .ENDIF .ELIF "$(BUILD64)" == "1" - CONFIGURE_ACTION=Configure linux-generic64 + .IF "$(UNAME)" == "GNU/kFreeBSD" + CONFIGURE_ACTION=Configure debian-kfreebsd-amd64 + .ELSE + CONFIGURE_ACTION=Configure linux-generic64 + .ENDIF .ELSE CONFIGURE_ACTION=Configure linux-generic32 .ENDIF diff --git a/openssl/openssllnx.patch b/openssl/openssllnx.patch index 2eb929474ae1..7f26b997bd1c 100644 --- a/openssl/openssllnx.patch +++ b/openssl/openssllnx.patch @@ -1,3 +1,15 @@ +--- misc/build/openssl-0.9.8l/Configure-old 2010-04-17 13:51:42.000000000 +0200 ++++ misc/build/openssl-0.9.8l/Configure 2010-04-17 13:52:03.000000000 +0200 +@@ -382,6 +382,9 @@ + + "bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + ++"debian-kfreebsd-amd64","gcc:-m64 -DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debian-kfreebsd-i386","gcc:-DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ + "nextstep", "cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", + "nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", + --- misc/openssl-0.9.8l/test/Makefile 2009-03-25 11:59:22.000000000 +0100 +++ misc/build/openssl-0.9.8l/test/Makefile 2009-03-30 12:51:00.210108929 +0200 @@ -408,7 +408,7 @@ diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 543acc5f71c5..cc7f61ec6a8b 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -46,6 +46,12 @@ #undef HAVE_STATFS_H #endif +#if defined(LINUX) && defined(__FreeBSD_kernel__) +#undef LINUX +#define FREEBSD 1 +#endif + + #if defined(SOLARIS) #include <sys/mnttab.h> diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index 8cb77c9b7fc8..1cb0979490c0 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -123,6 +123,11 @@ # define NO_PTHREAD_PRIORITY # define PTHREAD_SIGACTION pthread_sigaction #endif + +# ifndef ETIME +# define ETIME ETIMEDOUT +# endif + #endif #ifdef NETBSD diff --git a/sal/osl/unx/util.c b/sal/osl/unx/util.c index f969bfe566ec..5ba04db56021 100644 --- a/sal/osl/unx/util.c +++ b/sal/osl/unx/util.c @@ -162,7 +162,7 @@ static int osl_getHWAddr(const char *ifname, char* hard_addr) * And now, the real thing: the get address */ -#ifdef LINUX +#ifdef SIOCGIFHWADDR ret=ioctl(so, SIOCGIFHWADDR, &ifr); #else ret=ioctl(so, SIOCGIFADDR, &ifr); @@ -177,7 +177,7 @@ static int osl_getHWAddr(const char *ifname, char* hard_addr) close(so); -#ifdef LINUX +#ifdef SIOCGIFHWADDR memcpy(hard_addr,ifr.ifr_hwaddr.sa_data,8); #else memcpy(hard_addr,ifr.ifr_ifru.ifru_addr.sa_data,8); diff --git a/sal/rtl/source/macro.hxx b/sal/rtl/source/macro.hxx index 50f0d7de924e..3fa0fbe58f42 100644 --- a/sal/rtl/source/macro.hxx +++ b/sal/rtl/source/macro.hxx @@ -39,7 +39,11 @@ #elif defined SOLARIS #define THIS_OS "Solaris" #elif defined LINUX +#ifdef __FreeBSD_kernel__ +#define THIS_OS "kFreeBSD" +#else #define THIS_OS "Linux" +#endif #elif defined MACOSX #define THIS_OS "MacOSX" #elif defined NETBSD diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx index 1e783b4a4ec9..4b65c1dc83b2 100644 --- a/sax/inc/sax/tools/converter.hxx +++ b/sax/inc/sax/tools/converter.hxx @@ -32,6 +32,7 @@ #include <sal/types.h> +#include <com/sun/star/uno/Sequence.h> #include <com/sun/star/util/MeasureUnit.hpp> diff --git a/sax/prj/build.lst b/sax/prj/build.lst index e3f70c484610..653d77ce9e25 100644 --- a/sax/prj/build.lst +++ b/sax/prj/build.lst @@ -3,3 +3,4 @@ ax sax usr1 - all ax_mkout NULL ax sax\source\expatwrap nmake - all ax_expatwrap NULL ax sax\source\tools nmake - all ax_tools NULL ax sax\source\fastparser nmake - all ax_fastparser ax_expatwrap ax_tools NULL +ax sax\qa\cppunit nmake - all ax_qa_cppunit ax_tools NULL diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/cppunit/makefile.mk new file mode 100644 index 000000000000..e06eca25a737 --- /dev/null +++ b/sax/qa/cppunit/makefile.mk @@ -0,0 +1,71 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=../.. +PRJNAME=sax +TARGET=qa_cppunit + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +CFLAGSCXX += $(CPPUNIT_CFLAGS) +DLLPRE = # no leading "lib" on .so files + +# --- Libs --------------------------------------------------------- + +SHL1OBJS= \ + $(SLO)/test_converter.obj \ + + +SHL1STDLIBS= \ + $(SAXLIB) \ + $(SALLIB) \ + $(CPPUNITLIB) \ + + +SHL1TARGET= test_converter +SHL1RPATH = NONE +SHL1IMPLIB= i$(SHL1TARGET) +# SHL1DEF= $(MISC)/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +# DEF1EXPORTFILE= export.exp +SHL1VERSIONMAP= version.map + +# --- All object files --------------------------------------------- + +SLOFILES= \ + $(SHL1OBJS) \ + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk +.INCLUDE : _cppunit.mk + diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx new file mode 100644 index 000000000000..1ea781afff95 --- /dev/null +++ b/sax/qa/cppunit/test_converter.cxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <rtl/ustrbuf.hxx> + +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Duration.hpp> + +#include "sax/tools/converter.hxx" + + +using namespace ::com::sun::star; +using sax::Converter; + + +namespace { + +class ConverterTest + : public ::CppUnit::TestFixture +{ +public: + virtual void setUp(); + virtual void tearDown(); + + void testDuration(); + void testDateTime(); + + CPPUNIT_TEST_SUITE(ConverterTest); + CPPUNIT_TEST(testDuration); + CPPUNIT_TEST(testDateTime); + CPPUNIT_TEST_SUITE_END(); + +private: +}; + +void ConverterTest::setUp() +{ +} + +void ConverterTest::tearDown() +{ +} + +static bool eqDuration(util::Duration a, util::Duration b) { + return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.MilliSeconds == b.MilliSeconds + && a.Negative == b.Negative; +} + +static void doTest(util::Duration const & rid, char const*const pis, + char const*const i_pos = 0) +{ + char const*const pos((i_pos) ? i_pos : pis); + util::Duration od; + ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); + bool bSuccess = Converter::convertDuration(od, is); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT(eqDuration(rid, od)); + ::rtl::OUStringBuffer buf; + Converter::convertDuration(buf, od); + OSL_TRACE( + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); +} + +static void doTestDurationF(char const*const pis) +{ + util::Duration od; + bool bSuccess = Converter::convertDuration(od, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); + CPPUNIT_ASSERT(!bSuccess); +} + +void ConverterTest::testDuration() +{ + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" ); + doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" ); + doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" ); + doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); + doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999), + "PT9.999999999999999999999999999999S", "PT9.999S" ); + doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); + doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10), + "-P7Y6M5DT4H3M2.01S" ); + doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); + doTestDurationF("1Y1M"); // invalid: no ^P + doTestDurationF("P-1Y1M"); // invalid: - after P + doTestDurationF("P1M1Y"); // invalid: Y after M + doTestDurationF("PT1Y"); // invalid: Y after T + doTestDurationF("P1Y1M1M"); // invalid: M twice, no T + doTestDurationF("P1YT1MT1M"); // invalid: T twice + doTestDurationF("P1YT"); // invalid: T but no H,M,S + doTestDurationF("P99999999999Y"); // cannot parse so many Ys + doTestDurationF("PT.1S"); // invalid: no 0 preceding . + doTestDurationF("PT5M.134S"); // invalid: no 0 preceding . + doTestDurationF("PT1.S"); // invalid: no digit following . + OSL_TRACE("\nSAX CONVERTER TEST END\n"); +} + + +static bool eqDateTime(util::DateTime a, util::DateTime b) { + return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.HundredthSeconds == b.HundredthSeconds; +} + +static void doTest(util::DateTime const & rdt, char const*const pis, + char const*const i_pos = 0) +{ + char const*const pos((i_pos) ? i_pos : pis); + ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); + util::DateTime odt; + bool bSuccess( Converter::convertDateTime(odt, is) ); + OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d", + odt.Year, odt.Month, odt.Day, + odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT(eqDateTime(rdt, odt)); + ::rtl::OUStringBuffer buf; + Converter::convertDateTime(buf, odt, true); + OSL_TRACE( + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); +} + +static void doTestDateTimeF(char const*const pis) +{ + util::DateTime odt; + bool bSuccess = Converter::convertDateTime(odt, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d", + odt.Year, odt.Month, odt.Day, + odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); + CPPUNIT_ASSERT(!bSuccess); +} + +void ConverterTest::testDateTime() +{ + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" ); +// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" ); +// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/, + "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" ); +// "0001-02-01T12:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/, + "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" ); +// "0001-01-01T12:00:00" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.9999999999999999999999999999999999999", + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.9999999999999999999999999999999999999Z", + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333) + /*(0, 0, 0, 0, 2, 1, 333)*/, + "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ ); + doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+ + doTestDateTimeF( "1-01-01T00:00:00" ); // invalid: < 4 Y + doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M + doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D + doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H + doTestDateTimeF( "0001-01-01T00:0:00" ); // invalid: < 2 M + doTestDateTimeF( "0001-01-01T00:00:0" ); // invalid: < 2 S + doTestDateTimeF( "0001-01-01T00:00:00." ); // invalid: .$ + doTestDateTimeF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H + doTestDateTimeF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M + doTestDateTimeF( "0001-13-01T00:00:00" ); // invalid: M > 12 + doTestDateTimeF( "0001-01-32T00:00:00" ); // invalid: D > 31 + doTestDateTimeF( "0001-01-01T25:00:00" ); // invalid: H > 24 + doTestDateTimeF( "0001-01-01T00:60:00" ); // invalid: H > 59 + doTestDateTimeF( "0001-01-01T00:00:60" ); // invalid: S > 59 + doTestDateTimeF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0 + doTestDateTimeF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0 + doTestDateTimeF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0 + doTestDateTimeF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00 + doTestDateTimeF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00 + doTestDateTimeF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00 + doTestDateTimeF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00 + OSL_TRACE("\nSAX CONVERTER TEST END\n"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + diff --git a/sax/qa/cppunit/version.map b/sax/qa/cppunit/version.map new file mode 100644 index 000000000000..3308588ef6f8 --- /dev/null +++ b/sax/qa/cppunit/version.map @@ -0,0 +1,34 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +UDK_3_0_0 { + global: + cppunitTestPlugIn; + + local: + *; +}; diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 35bfba29c904..5df3044bd6d3 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1217,78 +1217,6 @@ bool Converter::convertDuration(util::Duration& rDuration, return bSuccess; } -#if 0 -//FIXME -struct Test { - static bool eqDuration(util::Duration a, util::Duration b) { - return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days - && a.Hours == b.Hours && a.Minutes == b.Minutes - && a.Seconds == b.Seconds - && a.MilliSeconds == b.MilliSeconds - && a.Negative == b.Negative; - } - static void doTest(util::Duration const & rid, char const*const pis, - char const*const i_pos = 0) - { - char const*const pos((i_pos) ? i_pos : pis); - util::Duration od; - ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); - bool bSuccess = Converter::convertDuration(od, is); - OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm", - od.Negative, od.Years, od.Months, od.Days, - od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); - OSL_ASSERT(bSuccess); - OSL_ASSERT(eqDuration(rid, od)); - ::rtl::OUStringBuffer buf; - Converter::convertDuration(buf, od); - OSL_TRACE( - ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); - OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); - } - static void doTestF(const char * pis) - { - util::Duration od; - bool bSuccess = Converter::convertDuration(od, - ::rtl::OUString::createFromAscii(pis)); - OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", - od.Negative, od.Years, od.Months, od.Days, - od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); - OSL_ASSERT(!bSuccess); - } - Test() { - OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); - doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" ); - doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" ); - doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" ); - doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); - doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999), - "PT9.999999999999999999999999999999S", "PT9.999S" ); - doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); - doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10), - "-P7Y6M5DT4H3M2.01S" ); - doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); - doTestF("1Y1M"); // invalid: no ^P - doTestF("P-1Y1M"); // invalid: - after P - doTestF("P1M1Y"); // invalid: Y after M - doTestF("PT1Y"); // invalid: Y after T - doTestF("P1Y1M1M"); // invalid: M twice, no T - doTestF("P1YT1MT1M"); // invalid: T twice - doTestF("P1YT"); // invalid: T but no H,M,S - doTestF("P99999999999Y"); // cannot parse so many Ys - doTestF("PT.1S"); // invalid: no 0 preceding . - doTestF("PT5M.134S"); // invalid: no 0 preceding . - doTestF("PT1.S"); // invalid: no digit following . - OSL_TRACE("\nSAX CONVERTER TEST END\n"); - } -}; -static Test test; -#endif /** convert util::Date to ISO "date" string */ void Converter::convertDate( @@ -1675,99 +1603,6 @@ bool Converter::convertDateOrDateTime( return bSuccess; } -#if 0 -struct Test { - static bool eqDateTime(util::DateTime a, util::DateTime b) { - return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day - && a.Hours == b.Hours && a.Minutes == b.Minutes - && a.Seconds == b.Seconds - && a.HundredthSeconds == b.HundredthSeconds; - } - static void doTest(util::DateTime const & rdt, char const*const pis, - char const*const i_pos = 0) - { - char const*const pos((i_pos) ? i_pos : pis); - ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); - util::DateTime odt; - bool bSuccess( Converter::convertDateTime(odt, is) ); - OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d", - odt.Year, odt.Month, odt.Day, - odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); - OSL_ASSERT(bSuccess); - OSL_ASSERT(eqDateTime(rdt, odt)); - ::rtl::OUStringBuffer buf; - Converter::convertDateTime(buf, odt, true); - OSL_TRACE( - ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); - OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); - } - static void doTestF(const char * pis) - { - util::DateTime odt; - bool bSuccess = Converter::convertDateTime(odt, - ::rtl::OUString::createFromAscii(pis)); - OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d", - odt.Year, odt.Month, odt.Day, - odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); - OSL_ASSERT(!bSuccess); - } - Test() { - OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), - "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" ); -// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" ); -// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" ); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), - "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), - "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/, - "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" ); -// "0001-02-01T12:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/, - "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" ); -// "0001-01-01T12:00:00" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.9999999999999999999999999999999999999", - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.9999999999999999999999999999999999999Z", - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333) - /*(0, 0, 0, 0, 2, 1, 333)*/, - "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ ); - doTestF( "+0001-01-01T00:00:00" ); // invalid: ^+ - doTestF( "1-01-01T00:00:00" ); // invalid: < 4 Y - doTestF( "0001-1-01T00:00:00" ); // invalid: < 2 M - doTestF( "0001-01-1T00:00:00" ); // invalid: < 2 D - doTestF( "0001-01-01T0:00:00" ); // invalid: < 2 H - doTestF( "0001-01-01T00:0:00" ); // invalid: < 2 M - doTestF( "0001-01-01T00:00:0" ); // invalid: < 2 S - doTestF( "0001-01-01T00:00:00." ); // invalid: .$ - doTestF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H - doTestF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M - doTestF( "0001-13-01T00:00:00" ); // invalid: M > 12 - doTestF( "0001-01-32T00:00:00" ); // invalid: D > 31 - doTestF( "0001-01-01T25:00:00" ); // invalid: H > 24 - doTestF( "0001-01-01T00:60:00" ); // invalid: H > 59 - doTestF( "0001-01-01T00:00:60" ); // invalid: S > 59 - doTestF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0 - doTestF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0 - doTestF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0 - doTestF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00 - doTestF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00 - doTestF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00 - doTestF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00 - OSL_TRACE("\nSAX CONVERTER TEST END\n"); - } -}; -static Test test; -#endif /** gets the position of the first comma after npos in the string rStr. Commas inside '"' pairs are not matched */ diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index c39d0deca0b7..503f0975c5c9 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -275,7 +275,6 @@ public: void CalcAfterLoad(); void CompileAll(); void CompileXML( ScProgress& rProgress ); - bool MarkUsedExternalReferences(); void ResetChanged( SCROW nStartRow, SCROW nEndRow ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 02c859723fa2..768dc815a482 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -906,7 +906,7 @@ public: bool ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, - SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ); + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const; SC_DLLPUBLIC BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; SC_DLLPUBLIC BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; SC_DLLPUBLIC BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index f47d99097b39..818920885493 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -36,12 +36,14 @@ #include "vcl/timer.hxx" #include "svl/zforlist.hxx" #include "scmatrix.hxx" +#include "rangelst.hxx" #include <hash_map> #include <hash_set> #include <boost/shared_ptr.hpp> #include <vector> #include <list> +#include <set> #include <formula/ExternalReferenceHelper.hxx> class ScDocument; @@ -55,6 +57,7 @@ class ScTokenArray; class String; class SfxObjectShellRef; class Window; +class ScFormulaCell; class ScExternalRefCache; @@ -126,6 +129,15 @@ public: class Table; friend class ScExternalRefCache::Table; + /** + * Represents a single cached table in an external document. It only + * stores non-empty cells; empty cells should never be stored in the data + * cache. Instead, cached ranges should be used to determine whether or + * not a cell is empty or needs fetching from the source document. If a + * cell's value is not stored but its address is within the cached ranges, + * that cell is already queried in the source document and we know it's + * empty. + */ class Table { public: @@ -140,7 +152,14 @@ public: Table(); ~Table(); - SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0); + /** + * Add cell value to the cache. + * + * @param bSetCacheRange if true, mark this cell 'cached'. This is + * false _only when_ adding a range of cell + * values, for performance reasons. + */ + SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0, bool bSetCacheRange = true); SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const; bool hasRow( SCROW nRow ) const; /** Set/clear referenced status flag only if current status is not @@ -151,18 +170,39 @@ public: ReferencedFlag getReferencedFlag() const; bool isReferenced() const; /// Obtain a sorted vector of rows. - void getAllRows(::std::vector<SCROW>& rRows) const; + void getAllRows(::std::vector<SCROW>& rRows, SCROW nLow = 0, SCROW nHigh = MAXROW) const; /// Returns the half-open range of used rows in this table. Returns [0,0) if table is empty. SC_DLLPUBLIC ::std::pair< SCROW, SCROW > getRowRange() const; /// Obtain a sorted vector of columns. - void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols) const; + void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols, SCCOL nLow = 0, SCCOL nHigh = MAXCOL) const; /// Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty. SC_DLLPUBLIC ::std::pair< SCCOL, SCCOL > getColRange( SCROW nRow ) const; void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; + const ScRangeList& getCachedRanges() const; + bool isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + + void setCachedCell(SCCOL nCol, SCROW nRow); + void setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + + /** + * Call this to mark the entire table "cached". This will prevent all + * future attempts to access the source document even when non-cached + * cells are queried. In such case, non-cached cells are treated as + * empty cells. Useful when loading a document with own external data + * cache. + */ + SC_DLLPUBLIC void setWholeTableCached(); + private: + bool isInCachedRanges(SCCOL nCol, SCROW nRow) const; + TokenRef getEmptyOrNullToken(SCCOL nCol, SCROW nRow) const; private: - RowsDataType maRows; - ReferencedFlag meReferenced; + /** Data cache */ + RowsDataType maRows; + /** Collection of individual cached ranges. The table ranges are + * not used & always zero. */ + ScRangeList maCachedRanges; + ReferencedFlag meReferenced; }; typedef ::boost::shared_ptr<Table> TableTypeRef; @@ -185,8 +225,7 @@ public: * @return pointer to the token instance in the cache. */ ScExternalRefCache::TokenRef getCellData( - sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, - bool bEmptyCellOnNull, bool bWriteEmpty, sal_uInt32* pnFmtIndex); + sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex); /** * Get a cached cell range data. @@ -196,12 +235,12 @@ public: * guaranteed if the TokenArrayRef is properly used.. */ ScExternalRefCache::TokenArrayRef getCellRangeData( - sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull, bool bWriteEmpty); + sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange); ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const String& rName); void setRangeNameTokens(sal_uInt16 nFileId, const String& rName, TokenArrayRef pArray); - void setCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol, TokenRef pToken, sal_uInt32 nFmtIndex); + void setCellData(sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex); struct SingleRangeData { @@ -325,58 +364,8 @@ class SC_DLLPUBLIC ScExternalRefManager : public formula::ExternalReferenceHelpe { public: - // SUNWS needs a forward declared friend, otherwise types and members - // of the outer class are not accessible. - class RefCells; - friend class ScExternalRefManager::RefCells; - - /** - * Collection of cell addresses that contain external references. This - * data is used for link updates. - */ - class RefCells - { - public: - RefCells(); - ~RefCells(); - - void insertCell(const ScAddress& rAddr); - void removeCell(const ScAddress& rAddr); - void moveTable(SCTAB nOldTab, SCTAB nNewTab, bool bCopy); - void insertTable(SCTAB nPos); - void removeTable(SCTAB nPos); - void refreshAllCells(ScExternalRefManager& rRefMgr); - private: - - typedef ::std::hash_set<SCROW> RowSet; - typedef ::std::hash_map<SCCOL, RowSet> ColSet; - - // SUNWS needs a forward declared friend, otherwise types and members - // of the outer class are not accessible. - struct TabItem; - friend struct ScExternalRefManager::RefCells::TabItem; - - struct TabItem - { - SCTAB mnIndex; - ColSet maCols; - explicit TabItem(SCTAB nIndex); - explicit TabItem(const TabItem& r); - }; - typedef ::boost::shared_ptr<TabItem> TabItemRef; - - /** - * Return the position that points either to the specified table - * position or to the position where a new table would be inserted in - * case the specified table is not present. - * - * @param nTab index of the desired table - */ - ::std::list<TabItemRef>::iterator getTabPos(SCTAB nTab); - - // This list must be sorted by the table index at all times. - ::std::list<TabItemRef> maTables; - }; + typedef ::std::set<ScFormulaCell*> RefCellSet; + typedef ::std::hash_map<sal_uInt16, RefCellSet> RefCellMap; enum LinkUpdateType { LINK_MODIFIED, LINK_BROKEN }; @@ -401,6 +390,21 @@ public: }; }; + /** + * Use this guard when performing something from the API that might query + * values from external references. Interpreting formula strings is one + * such example. + */ + class ApiGuard + { + public: + ApiGuard(ScDocument* pDoc); + ~ApiGuard(); + private: + ScExternalRefManager* mpMgr; + bool mbOldInteractionEnabled; + }; + private: /** Shell instance for a source document. */ struct SrcShell @@ -412,7 +416,6 @@ private: typedef ::std::hash_map<sal_uInt16, SrcShell> DocShellMap; typedef ::std::hash_map<sal_uInt16, bool> LinkedDocMap; - typedef ::std::hash_map<sal_uInt16, RefCells> RefCellMap; typedef ::std::hash_map<sal_uInt16, SvNumberFormatterMergeMap> NumFmtMap; @@ -516,12 +519,7 @@ public: */ bool markUsedByLinkListeners(); - /** - * Set all tables of a document as referenced, used only during - * store-to-file. - * @returns <TRUE/> if ALL tables of ALL external documents are marked. - */ - bool setCacheDocReferenced( sal_uInt16 nFileId ); + bool markUsedExternalRefCells(); /** * Set a table as referenced, used only during store-to-file. @@ -540,7 +538,7 @@ public: * @returns <TRUE/> if setAllCacheTableReferencedStati(false) was called, * <FALSE/> if setAllCacheTableReferencedStati(true) was called. */ - bool isInReferenceMarking() const { return bInReferenceMarking; } + bool isInReferenceMarking() const { return mbInReferenceMarking; } void storeRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScTokenArray& rArray); @@ -561,7 +559,8 @@ public: * @return shared_ptr to a token array instance. <i>The caller must not * delete the instance returned by this method.</i> */ - ScExternalRefCache::TokenArrayRef getDoubleRefTokens(sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos); + ScExternalRefCache::TokenArrayRef getDoubleRefTokens( + sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos); /** * Get an array of tokens corresponding with a specified name in a @@ -574,7 +573,8 @@ public: * * @return shared_ptr to array of tokens composing the name */ - ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScAddress* pCurPos = NULL); + ScExternalRefCache::TokenArrayRef getRangeNameTokens( + sal_uInt16 nFileId, const String& rName, const ScAddress* pCurPos = NULL); const String& getOwnDocumentName() const; bool isOwnDocument(const String& rFile) const; @@ -646,32 +646,12 @@ public: void resetSrcFileData(const String& rBaseFileUrl); /** - * Update a single referencing cell position. + * Stop tracking a specific formula cell. * - * @param rOldPos old position - * @param rNewPos new position + * @param pCell pointer to cell that formerly contained external + * reference. */ - void updateRefCell(const ScAddress& rOldPos, const ScAddress& rNewPos, bool bCopy); - - /** - * Update referencing cells affected by sheet movement. - * - * @param nOldTab old sheet position - * @param nNewTab new sheet position - * @param bCopy whether this is a sheet move (false) or sheet copy (true) - */ - void updateRefMoveTable(SCTAB nOldTab, SCTAB nNewTab, bool bCopy); - - /** - * Update referencing cells affected by sheet insertion. - * - * @param nPos sheet insertion position. All sheets to the right - * including the one at the insertion poistion shift to the - * right by one. - */ - void updateRefInsertTable(SCTAB nPos); - - void updateRefDeleteTable(SCTAB nPos); + void removeRefCell(ScFormulaCell* pCell); /** * Register a new link listener to a specified external document. Note @@ -723,8 +703,6 @@ private: */ void maybeCreateRealFileName(sal_uInt16 nFileId); - bool compileTokensByCell(const ScAddress& rCell); - /** * Purge those source document instances that have not been accessed for * the specified duration. @@ -764,7 +742,13 @@ private: ::std::vector<SrcFileData> maSrcFiles; /** Status whether in reference marking state. See isInReferenceMarking(). */ - bool bInReferenceMarking; + bool mbInReferenceMarking:1; + + /** + * Controls whether or not to allow user interaction. We don't want any + * user interaction when calling from the API. + */ + bool mbUserInteractionEnabled:1; AutoTimer maSrcDocTimer; DECL_LINK(TimeOutHdl, AutoTimer*); diff --git a/sc/inc/linkuno.hxx b/sc/inc/linkuno.hxx index 50b33c692752..284d851a45da 100644 --- a/sc/inc/linkuno.hxx +++ b/sc/inc/linkuno.hxx @@ -543,7 +543,7 @@ public: // XExternalDocLink virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache > - SAL_CALL addSheetCache( const ::rtl::OUString& aSheetName ) + SAL_CALL addSheetCache( const ::rtl::OUString& aSheetName, sal_Bool bDynamicCache ) throw (::com::sun::star::uno::RuntimeException); // XNameAccess diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 950f07565e19..aed123bd7a65 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -380,7 +380,7 @@ public: SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow ); void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, - BOOL bIncludeOld, bool bOnlyDown ) const; + BOOL bIncludeOld, bool bOnlyDown ) const; bool ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; @@ -419,7 +419,6 @@ public: void CalcAfterLoad(); void CompileAll(); void CompileXML( ScProgress& rProgress ); - bool MarkUsedExternalReferences(); void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index ed6dc17fb2a0..4c27c656d15c 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -189,6 +189,9 @@ interface CellSelection SID_HANGUL_HANJA_CONVERSION [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] SID_CHINESE_CONVERSION [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] + SID_TRANSLITERATE_SENTENCE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_TITLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_TOGGLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] SID_TRANSLITERATE_LOWER [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index cde7d77753a9..cad53257c136 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -62,6 +62,8 @@ interface TableDrawText SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_THES [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_THESAURUS [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] // Attribute: -------------------------------------------------- SID_TEXT_STANDARD [ ExecMethod = ExecuteAttr; StateMethod = GetState; Export = FALSE; ] SID_DRAWTEXT_ATTR_DLG [ ExecMethod = ExecuteAttr; StateMethod = GetState; Export = FALSE; ] @@ -126,6 +128,9 @@ interface TableDrawText SID_VERTICALTEXT_STATE [ StateMethod = GetAttrState ; Export = FALSE; ] SID_CTLFONT_STATE [ StateMethod = GetAttrState ; Export = FALSE; ] + SID_TRANSLITERATE_SENTENCE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_TITLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_TOGGLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_LOWER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi index ae71120c883e..1d95f2debdc3 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -46,6 +46,7 @@ interface TableText SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] FID_INSERT_NAME [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_THES [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_UNDO [ ExecMethod = ExecuteUndo; StateMethod = GetUndoState; Export = FALSE; ] SID_REDO [ ExecMethod = ExecuteUndo; StateMethod = GetUndoState; Export = FALSE; ] @@ -80,6 +81,9 @@ interface TableText SID_HYPERLINK_GETLINK [ StateMethod = GetState; Export = FALSE; ] SID_OPEN_HYPERLINK [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_SENTENCE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_TITLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_TOGGLE_CASE [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_LOWER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 56be361f6d38..a70a9b86e186 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -819,6 +819,10 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons ScFormulaCell::~ScFormulaCell() { pDocument->RemoveFromFormulaTree( this ); + + if (pDocument->HasExternalRefManager()) + pDocument->GetExternalRefManager()->removeRefCell(this); + delete pCode; #ifdef DBG_UTIL eCellType = CELLTYPE_DESTROYED; diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 4de78c71fe79..1aab26acf3aa 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -1038,17 +1038,6 @@ void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode, delete pOld; } - - pCode->Reset(); - for ( formula::FormulaToken* t = pCode->GetNextReferenceOrName(); t; t = pCode->GetNextReferenceOrName() ) - { - StackVar sv = t->GetType(); - if (sv == svExternalSingleRef || sv == svExternalDoubleRef || sv == svExternalName) - { - pDocument->GetExternalRefManager()->updateRefCell(aOldPos, aPos, eUpdateRefMode == URM_COPY); - break; - } - } } void ScFormulaCell::UpdateInsertTab(SCTAB nTable) diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index ee670d5ba0ef..6a5fe824197b 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2100,22 +2100,6 @@ void ScColumn::CalcAfterLoad() } -bool ScColumn::MarkUsedExternalReferences() -{ - bool bAllMarked = false; - if (pItems) - { - for (SCSIZE i = 0; i < nCount && !bAllMarked; ++i) - { - ScBaseCell* pCell = pItems[i].pCell; - if ( pCell->GetCellType() == CELLTYPE_FORMULA ) - bAllMarked = ((ScFormulaCell*)pCell)->MarkUsedExternalReferences(); - } - } - return bAllMarked; -} - - void ScColumn::ResetChanged( SCROW nStartRow, SCROW nEndRow ) { if (pItems) diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 138b55f0794c..c5922aa88dcc 100755 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -804,10 +804,6 @@ BOOL ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos ) if (pDrawLayer) DrawMovePage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) ); - // Update cells containing external references. - if (pExternalRefMgr.get()) - pExternalRefMgr->updateRefMoveTable(nOldPos, nNewPos, false); - bValid = TRUE; } } @@ -925,10 +921,6 @@ BOOL ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM pTab[nNewPos]->SetPageStyle( pTab[nOldPos]->GetPageStyle() ); pTab[nNewPos]->SetPendingRowHeights( pTab[nOldPos]->IsPendingRowHeights() ); - - // Update cells containing external references. - if (pExternalRefMgr.get()) - pExternalRefMgr->updateRefMoveTable(nOldPos, nNewPos, true); } else SetAutoCalc( bOldAutoCalc ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 557f181c9d8f..77f59254e049 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -465,11 +465,8 @@ void ScDocument::MarkUsedExternalReferences() // Charts. bool bAllMarked = pExternalRefMgr->markUsedByLinkListeners(); // Formula cells. - for (SCTAB nTab = 0; !bAllMarked && nTab < nMaxTableNumber; ++nTab) - { - if (pTab[nTab]) - bAllMarked = pTab[nTab]->MarkUsedExternalReferences(); - } + bAllMarked = pExternalRefMgr->markUsedExternalRefCells(); + /* NOTE: Conditional formats and validation objects are marked when * collecting them during export. */ } diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index d6653402c46a..d86d174ab414 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -705,6 +705,9 @@ void ScDocument::UpdateChartListenerCollection() SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); DBG_ASSERT(pPage,"Page ?"); + if (!pPage) + continue; + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); SdrObject* pObject = aIter.Next(); while (pObject) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ff132a1f204b..7c08c4327183 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -375,10 +375,6 @@ BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName, if ( pChartListenerCollection ) pChartListenerCollection->UpdateScheduledSeriesRanges(); - // Update cells containing external references. - if (pExternalRefMgr.get()) - pExternalRefMgr->updateRefInsertTable(nPos); - SetDirty(); bValid = TRUE; } @@ -467,11 +463,6 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc ) // #81844# sheet names of references are not valid until sheet is deleted pChartListenerCollection->UpdateScheduledSeriesRanges(); - - // Update cells containing external references. - if (pExternalRefMgr.get()) - pExternalRefMgr->updateRefDeleteTable(nTab); - SetAutoCalc( bOldAutoCalc ); bValid = TRUE; } @@ -694,6 +685,10 @@ bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow if (nRow2 < rEndRow) rEndRow = nRow2; + if (rStartCol > rEndCol || rStartRow > rEndRow) + // invalid range. + return false; + return true; // success! } @@ -708,11 +703,10 @@ bool ScDocument::ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, // zusammenhaengender Bereich void ScDocument::GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, - SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const { - if (VALIDTAB(nTab)) - if (pTab[nTab]) - pTab[nTab]->GetDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bIncludeOld, bOnlyDown ); + if (ValidTab(nTab) && pTab[nTab]) + pTab[nTab]->GetDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bIncludeOld, bOnlyDown ); } diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 75b288272c1e..a8b819072c21 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -678,7 +678,7 @@ BOOL ScTable::GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const } void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, - BOOL bIncludeOld, bool bOnlyDown ) const + BOOL bIncludeOld, bool bOnlyDown ) const { BOOL bLeft = FALSE; BOOL bRight = FALSE; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 4dc7dddcaba1..69d16df7be58 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1119,17 +1119,6 @@ void ScTable::CalcAfterLoad() } -bool ScTable::MarkUsedExternalReferences() -{ - bool bAllMarked = false; - for (SCCOL i=0; i <= MAXCOL && !bAllMarked; ++i) - { - bAllMarked = aCol[i].MarkUsedExternalReferences(); - } - return bAllMarked; -} - - void ScTable::ResetChanged( const ScRange& rRange ) { SCCOL nStartCol = rRange.aStart.Col(); diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx index 47418ec85f4d..5b3b92f78ee4 100644 --- a/sc/source/core/tool/queryparam.cxx +++ b/sc/source/core/tool/queryparam.cxx @@ -171,7 +171,11 @@ ScQueryParamTable::~ScQueryParamTable() ScQueryParam::ScQueryParam() : ScQueryParamBase(), - ScQueryParamTable() + ScQueryParamTable(), + bDestPers(true), + nDestTab(0), + nDestCol(0), + nDestRow(0) { Clear(); } diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index 5b9cc3180699..3aef51d10c54 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -1211,7 +1211,9 @@ FltError ImportExcel8::Read( void ) pProgress.reset(); - AdjustRowHeight(); + if (pD->IsAdjustHeightEnabled()) + AdjustRowHeight(); + PostDocLoad(); pD->CalcAfterLoad(); diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 1564b2db834e..b6b136da4b1e 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -39,6 +39,8 @@ #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -52,6 +54,9 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> +#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart2/LegendPosition.hpp> +#include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> @@ -75,38 +80,47 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::i18n::XBreakIterator; using ::com::sun::star::frame::XModel; +using ::com::sun::star::drawing::XShape; using ::com::sun::star::drawing::XShapes; + +using ::com::sun::star::chart2::IncrementData; +using ::com::sun::star::chart2::RelativePosition; +using ::com::sun::star::chart2::ScaleData; +using ::com::sun::star::chart2::SubIncrement; +using ::com::sun::star::chart2::XAxis; using ::com::sun::star::chart2::XChartDocument; -using ::com::sun::star::chart2::XDiagram; -using ::com::sun::star::chart2::XCoordinateSystemContainer; -using ::com::sun::star::chart2::XCoordinateSystem; using ::com::sun::star::chart2::XChartTypeContainer; +using ::com::sun::star::chart2::XColorScheme; +using ::com::sun::star::chart2::XCoordinateSystem; +using ::com::sun::star::chart2::XCoordinateSystemContainer; using ::com::sun::star::chart2::XChartType; -using ::com::sun::star::chart2::XDataSeriesContainer; using ::com::sun::star::chart2::XDataSeries; -using ::com::sun::star::chart2::XRegressionCurveContainer; +using ::com::sun::star::chart2::XDataSeriesContainer; +using ::com::sun::star::chart2::XDiagram; +using ::com::sun::star::chart2::XFormattedString; +using ::com::sun::star::chart2::XLegend; using ::com::sun::star::chart2::XRegressionCurve; -using ::com::sun::star::chart2::XAxis; +using ::com::sun::star::chart2::XRegressionCurveContainer; using ::com::sun::star::chart2::XScaling; -using ::com::sun::star::chart2::ScaleData; -using ::com::sun::star::chart2::IncrementData; -using ::com::sun::star::chart2::SubIncrement; -using ::com::sun::star::chart2::XLegend; -using ::com::sun::star::chart2::XTitled; using ::com::sun::star::chart2::XTitle; -using ::com::sun::star::chart2::XFormattedString; -using ::com::sun::star::chart2::XColorScheme; +using ::com::sun::star::chart2::XTitled; + +using ::com::sun::star::chart2::data::XDataSequence; using ::com::sun::star::chart2::data::XDataSource; using ::com::sun::star::chart2::data::XLabeledDataSequence; -using ::com::sun::star::chart2::data::XDataSequence; using ::formula::FormulaGrammar; using ::formula::FormulaToken; +namespace cssc = ::com::sun::star::chart; +namespace cssc2 = ::com::sun::star::chart2; + // Helpers ==================================================================== namespace { @@ -160,13 +174,15 @@ bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, bool bLogSc // Common ===================================================================== /** Stores global data needed in various classes of the Chart export filter. */ -class XclExpChRootData : public XclChRootData +struct XclExpChRootData : public XclChRootData { -public: - explicit XclExpChRootData( XclExpChChart* pChartData ); + typedef ::std::vector< XclChFrBlock > XclChFrBlockVector; + + XclExpChChart& mrChartData; /// The chart data object. + XclChFrBlockVector maWrittenFrBlocks; /// Stack of future record levels already written out. + XclChFrBlockVector maUnwrittenFrBlocks; /// Stack of future record levels not yet written out. - /** Returns a reference to the parent chart data object. */ - inline XclExpChChart& GetChartData() const { return *mpChartData; } + inline explicit XclExpChRootData( XclExpChChart& rChartData ) : mrChartData( rChartData ) {} /** Registers a new future record level. */ void RegisterFutureRecBlock( const XclChFrBlock& rFrBlock ); @@ -174,22 +190,10 @@ public: void InitializeFutureRecBlock( XclExpStream& rStrm ); /** Finalizes the current future record level (writes CHFRBLOCKEND record if needed). */ void FinalizeFutureRecBlock( XclExpStream& rStrm ); - -private: - typedef ::std::vector< XclChFrBlock > XclChFrBlockVector; - - XclExpChChart* mpChartData; /// Pointer to the chart data object. - XclChFrBlockVector maWrittenFrBlocks; /// Stack of future record levels already written out. - XclChFrBlockVector maUnwrittenFrBlocks; /// Stack of future record levels not yet written out. }; // ---------------------------------------------------------------------------- -XclExpChRootData::XclExpChRootData( XclExpChChart* pChartData ) : - mpChartData( pChartData ) -{ -} - void XclExpChRootData::RegisterFutureRecBlock( const XclChFrBlock& rFrBlock ) { maUnwrittenFrBlocks.push_back( rFrBlock ); @@ -238,9 +242,9 @@ void XclExpChRootData::FinalizeFutureRecBlock( XclExpStream& rStrm ) // ---------------------------------------------------------------------------- -XclExpChRoot::XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart* pChartData ) : +XclExpChRoot::XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart& rChartData ) : XclExpRoot( rRoot ), - mxChData( new XclExpChRootData( pChartData ) ) + mxChData( new XclExpChRootData( rChartData ) ) { } @@ -248,29 +252,34 @@ XclExpChRoot::~XclExpChRoot() { } +Reference< XChartDocument > XclExpChRoot::GetChartDocument() const +{ + return mxChData->mxChartDoc; +} + XclExpChChart& XclExpChRoot::GetChartData() const { - return mxChData->GetChartData(); + return mxChData->mrChartData; } const XclChTypeInfo& XclExpChRoot::GetChartTypeInfo( XclChTypeId eType ) const { - return mxChData->GetTypeInfoProvider().GetTypeInfo( eType ); + return mxChData->mxTypeInfoProv->GetTypeInfo( eType ); } const XclChTypeInfo& XclExpChRoot::GetChartTypeInfo( const OUString& rServiceName ) const { - return mxChData->GetTypeInfoProvider().GetTypeInfoFromService( rServiceName ); + return mxChData->mxTypeInfoProv->GetTypeInfoFromService( rServiceName ); } const XclChFormatInfo& XclExpChRoot::GetFormatInfo( XclChObjectType eObjType ) const { - return mxChData->GetFormatInfoProvider().GetFormatInfo( eObjType ); + return mxChData->mxFmtInfoProv->GetFormatInfo( eObjType ); } -void XclExpChRoot::InitConversion( XChartDocRef xChartDoc ) const +void XclExpChRoot::InitConversion( XChartDocRef xChartDoc, const Rectangle& rChartRect ) const { - mxChData->InitConversion( xChartDoc ); + mxChData->InitConversion( GetRoot(), xChartDoc, rChartRect ); } void XclExpChRoot::FinishConversion() const @@ -291,11 +300,41 @@ void XclExpChRoot::SetSystemColor( Color& rColor, sal_uInt32& rnColorId, sal_uIn rnColorId = XclExpPalette::GetColorIdFromIndex( nSysColorIdx ); } +sal_Int32 XclExpChRoot::CalcChartXFromHmm( sal_Int32 nPosX ) const +{ + return ::limit_cast< sal_Int32, double >( (nPosX - mxChData->mnBorderGapX) / mxChData->mfUnitSizeX, 0, EXC_CHART_TOTALUNITS ); +} + +sal_Int32 XclExpChRoot::CalcChartYFromHmm( sal_Int32 nPosY ) const +{ + return ::limit_cast< sal_Int32, double >( (nPosY - mxChData->mnBorderGapY) / mxChData->mfUnitSizeY, 0, EXC_CHART_TOTALUNITS ); +} + +XclChRectangle XclExpChRoot::CalcChartRectFromHmm( const ::com::sun::star::awt::Rectangle& rRect ) const +{ + XclChRectangle aRect; + aRect.mnX = CalcChartXFromHmm( rRect.X ); + aRect.mnY = CalcChartYFromHmm( rRect.Y ); + aRect.mnWidth = CalcChartXFromHmm( rRect.Width ); + aRect.mnHeight = CalcChartYFromHmm( rRect.Height ); + return aRect; +} + +sal_Int32 XclExpChRoot::CalcChartXFromRelative( double fPosX ) const +{ + return CalcChartXFromHmm( static_cast< sal_Int32 >( fPosX * mxChData->maChartRect.GetWidth() + 0.5 ) ); +} + +sal_Int32 XclExpChRoot::CalcChartYFromRelative( double fPosY ) const +{ + return CalcChartYFromHmm( static_cast< sal_Int32 >( fPosY * mxChData->maChartRect.GetHeight() + 0.5 ) ); +} + void XclExpChRoot::ConvertLineFormat( XclChLineFormat& rLineFmt, const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode ) const { GetChartPropSetHelper().ReadLineProperties( - rLineFmt, mxChData->GetLineDashTable(), rPropSet, ePropMode ); + rLineFmt, *mxChData->mxLineDashTable, rPropSet, ePropMode ); } bool XclExpChRoot::ConvertAreaFormat( XclChAreaFormat& rAreaFmt, @@ -309,7 +348,7 @@ void XclExpChRoot::ConvertEscherFormat( const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode ) const { GetChartPropSetHelper().ReadEscherProperties( rEscherFmt, rPicFmt, - mxChData->GetGradientTable(), mxChData->GetHatchTable(), mxChData->GetBitmapTable(), rPropSet, ePropMode ); + *mxChData->mxGradientTable, *mxChData->mxHatchTable, *mxChData->mxBitmapTable, rPropSet, ePropMode ); } sal_uInt16 XclExpChRoot::ConvertFont( const ScfPropertySet& rPropSet, sal_Int16 nScript ) const @@ -404,6 +443,20 @@ void XclExpChFutureRecordBase::Save( XclExpStream& rStrm ) // Frame formatting =========================================================== +XclExpChFramePos::XclExpChFramePos( sal_uInt16 nTLMode, sal_uInt16 nBRMode ) : + XclExpRecord( EXC_ID_CHFRAMEPOS, 20 ) +{ + maData.mnTLMode = nTLMode; + maData.mnBRMode = nBRMode; +} + +void XclExpChFramePos::WriteBody( XclExpStream& rStrm ) +{ + rStrm << maData.mnTLMode << maData.mnBRMode << maData.maRect; +} + +// ---------------------------------------------------------------------------- + XclExpChLineFormat::XclExpChLineFormat( const XclExpChRoot& rRoot ) : XclExpRecord( EXC_ID_CHLINEFORMAT, (rRoot.GetBiff() == EXC_BIFF8) ? 12 : 10 ), mnColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) ) @@ -1118,6 +1171,36 @@ void XclExpChText::ConvertTitle( Reference< XTitle > xTitle, sal_uInt16 nTarget // rotation ConvertRotationBase( GetChRoot(), aTitleProp, true ); + + // manual text position - only for main title + mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_PARENT, EXC_CHFRAMEPOS_PARENT ) ); + if( nTarget == EXC_CHOBJLINK_TITLE ) + { + Any aRelPos; + if( aTitleProp.GetAnyProperty( aRelPos, EXC_CHPROP_RELATIVEPOSITION ) && aRelPos.has< RelativePosition >() ) try + { + // calculate absolute position for CHTEXT record + Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); + Reference< XShape > xTitleShape( xChart1Doc->getTitle(), UNO_SET_THROW ); + ::com::sun::star::awt::Point aPos = xTitleShape->getPosition(); + ::com::sun::star::awt::Size aSize = xTitleShape->getSize(); + ::com::sun::star::awt::Rectangle aRect( aPos.X, aPos.Y, aSize.Width, aSize.Height ); + maData.maRect = CalcChartRectFromHmm( aRect ); + ::insert_value( maData.mnFlags2, EXC_CHTEXT_POS_MOVED, 0, 4 ); + // manual title position implies manual plot area + GetChartData().SetManualPlotArea(); + // calculate the default title position in chart units + sal_Int32 nDefPosX = ::std::max< sal_Int32 >( (EXC_CHART_TOTALUNITS - maData.maRect.mnWidth) / 2, 0 ); + sal_Int32 nDefPosY = 85; + // set the position relative to the standard position + XclChRectangle& rFrameRect = mxFramePos->GetFramePosData().maRect; + rFrameRect.mnX = maData.maRect.mnX - nDefPosX; + rFrameRect.mnY = maData.maRect.mnY - nDefPosY; + } + catch( Exception& ) + { + } + } } else { @@ -1137,8 +1220,7 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet, { SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_DATALABEL, rPointPos.mnPointIdx, rPointPos.mnSeriesIdx ); - namespace cssc = ::com::sun::star::chart2; - cssc::DataPointLabel aPointLabel; + cssc2::DataPointLabel aPointLabel; if( !rPropSet.GetProperty( aPointLabel, EXC_CHPROP_LABEL ) ) return false; @@ -1184,31 +1266,33 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet, ConvertRotationBase( GetChRoot(), rPropSet, false ); // label placement sal_Int32 nPlacement = 0; + sal_uInt16 nLabelPos = EXC_CHTEXT_POS_AUTO; if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) ) { using namespace ::com::sun::star::chart::DataLabelPlacement; if( nPlacement == rTypeInfo.mnDefaultLabelPos ) { - maData.mnPlacement = EXC_CHTEXT_POS_DEFAULT; + nLabelPos = EXC_CHTEXT_POS_DEFAULT; } else switch( nPlacement ) { - case AVOID_OVERLAP: maData.mnPlacement = EXC_CHTEXT_POS_AUTO; break; - case CENTER: maData.mnPlacement = EXC_CHTEXT_POS_CENTER; break; - case TOP: maData.mnPlacement = EXC_CHTEXT_POS_ABOVE; break; - case TOP_LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break; - case LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break; - case BOTTOM_LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break; - case BOTTOM: maData.mnPlacement = EXC_CHTEXT_POS_BELOW; break; - case BOTTOM_RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break; - case RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break; - case TOP_RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break; - case INSIDE: maData.mnPlacement = EXC_CHTEXT_POS_INSIDE; break; - case OUTSIDE: maData.mnPlacement = EXC_CHTEXT_POS_OUTSIDE; break; - case NEAR_ORIGIN: maData.mnPlacement = EXC_CHTEXT_POS_AXIS; break; + case AVOID_OVERLAP: nLabelPos = EXC_CHTEXT_POS_AUTO; break; + case CENTER: nLabelPos = EXC_CHTEXT_POS_CENTER; break; + case TOP: nLabelPos = EXC_CHTEXT_POS_ABOVE; break; + case TOP_LEFT: nLabelPos = EXC_CHTEXT_POS_LEFT; break; + case LEFT: nLabelPos = EXC_CHTEXT_POS_LEFT; break; + case BOTTOM_LEFT: nLabelPos = EXC_CHTEXT_POS_LEFT; break; + case BOTTOM: nLabelPos = EXC_CHTEXT_POS_BELOW; break; + case BOTTOM_RIGHT: nLabelPos = EXC_CHTEXT_POS_RIGHT; break; + case RIGHT: nLabelPos = EXC_CHTEXT_POS_RIGHT; break; + case TOP_RIGHT: nLabelPos = EXC_CHTEXT_POS_RIGHT; break; + case INSIDE: nLabelPos = EXC_CHTEXT_POS_INSIDE; break; + case OUTSIDE: nLabelPos = EXC_CHTEXT_POS_OUTSIDE; break; + case NEAR_ORIGIN: nLabelPos = EXC_CHTEXT_POS_AXIS; break; default: DBG_ERRORFILE( "XclExpChText::ConvertDataLabel - unknown label placement type" ); } } + ::insert_value( maData.mnFlags2, nLabelPos, 0, 4 ); // source link (contains number format) mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) ); if( bShowValue || bShowPercent ) @@ -1255,6 +1339,8 @@ sal_uInt16 XclExpChText::GetAttLabelFlags() const void XclExpChText::WriteSubRecords( XclExpStream& rStrm ) { + // CHFRAMEPOS record + lclSaveRecord( rStrm, mxFramePos ); // CHFONT record lclSaveRecord( rStrm, mxFont ); // CHSOURCELINK group @@ -1279,7 +1365,7 @@ void XclExpChText::WriteBody( XclExpStream& rStrm ) if( GetBiff() == EXC_BIFF8 ) { rStrm << GetPalette().GetColorIndex( mnTextColorId ) - << maData.mnPlacement + << maData.mnFlags2 << maData.mnRotation; } } @@ -1604,7 +1690,6 @@ bool XclExpChSerErrorBar::Convert( XclExpChSourceLink& rValueLink, sal_uInt16& r bool bOk = rPropSet.GetProperty( nBarStyle, EXC_CHPROP_ERRORBARSTYLE ); if( bOk ) { - namespace cssc = ::com::sun::star::chart; switch( nBarStyle ) { case cssc::ErrorBarStyle::ABSOLUTE: @@ -2148,12 +2233,66 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) // text properties mxText.reset( new XclExpChText( GetChRoot() ) ); mxText->ConvertLegend( rPropSet ); - // special legend properties - GetChartPropSetHelper().ReadLegendProperties( maData, rPropSet ); + + // legend position + Any aRelPosAny; + rPropSet.GetAnyProperty( aRelPosAny, EXC_CHPROP_RELATIVEPOSITION ); + if( aRelPosAny.has< RelativePosition >() ) + { + try + { + /* The 'RelativePosition' property is used as indicator of manually + changed legend position, but due to the different anchor modes + used by this property (in the RelativePosition.Anchor member) + it cannot be used to calculate the position easily. For this, + the Chart1 API will be used instead. */ + Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); + Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW ); + // coordinates in CHLEGEND record written but not used by Excel + mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_CHARTSIZE, EXC_CHFRAMEPOS_PARENT ) ); + XclChFramePos& rFramePos = mxFramePos->GetFramePosData(); + rFramePos.maRect.mnX = maData.maRect.mnX = CalcChartXFromHmm( xChart1Legend->getPosition().X ); + rFramePos.maRect.mnY = maData.maRect.mnY = CalcChartYFromHmm( xChart1Legend->getPosition().Y ); + // manual legend position implies manual plot area + GetChartData().SetManualPlotArea(); + maData.mnDockMode = EXC_CHLEGEND_NOTDOCKED; + } + catch( Exception& ) + { + OSL_ENSURE( false, "XclExpChLegend::Convert - cannot get legend shape" ); + maData.mnDockMode = EXC_CHLEGEND_RIGHT; + } + } + else + { + cssc2::LegendPosition eApiPos = cssc2::LegendPosition_CUSTOM; + rPropSet.GetProperty( eApiPos, EXC_CHPROP_ANCHORPOSITION ); + switch( eApiPos ) + { + case cssc2::LegendPosition_LINE_START: maData.mnDockMode = EXC_CHLEGEND_LEFT; break; + case cssc2::LegendPosition_LINE_END: maData.mnDockMode = EXC_CHLEGEND_RIGHT; break; + case cssc2::LegendPosition_PAGE_START: maData.mnDockMode = EXC_CHLEGEND_TOP; break; + case cssc2::LegendPosition_PAGE_END: maData.mnDockMode = EXC_CHLEGEND_BOTTOM; break; + default: + OSL_ENSURE( false, "XclExpChLegend::Convert - unrecognized legend position" ); + maData.mnDockMode = EXC_CHLEGEND_RIGHT; + } + } + + // legend expansion + cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; + rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION ); + ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand != cssc2::LegendExpansion_WIDE ); + + // other flags + ::set_flag( maData.mnFlags, EXC_CHLEGEND_AUTOSERIES ); + const sal_uInt16 nAutoFlags = EXC_CHLEGEND_DOCKED | EXC_CHLEGEND_AUTOPOSX | EXC_CHLEGEND_AUTOPOSY; + ::set_flag( maData.mnFlags, nAutoFlags, maData.mnDockMode != EXC_CHLEGEND_NOTDOCKED ); } void XclExpChLegend::WriteSubRecords( XclExpStream& rStrm ) { + lclSaveRecord( rStrm, mxFramePos ); lclSaveRecord( rStrm, mxText ); lclSaveRecord( rStrm, mxFrame ); } @@ -2252,13 +2391,12 @@ void XclExpChTypeGroup::ConvertSeries( { // stacking direction (stacked/percent/deep 3d) from first series ScfPropertySet aSeriesProp( aSeriesVec.front() ); - namespace cssc = ::com::sun::star::chart2; - cssc::StackingDirection eStacking; + cssc2::StackingDirection eStacking; if( !aSeriesProp.GetProperty( eStacking, EXC_CHPROP_STACKINGDIR ) ) - eStacking = cssc::StackingDirection_NO_STACKING; + eStacking = cssc2::StackingDirection_NO_STACKING; // stacked or percent chart - if( maTypeInfo.mbSupportsStacking && (eStacking == cssc::StackingDirection_Y_STACKING) ) + if( maTypeInfo.mbSupportsStacking && (eStacking == cssc2::StackingDirection_Y_STACKING) ) { // percent overrides simple stacking maType.SetStacked( bPercent ); @@ -2275,7 +2413,7 @@ void XclExpChTypeGroup::ConvertSeries( } // deep 3d chart or clustered 3d chart (stacked is not clustered) - if( (eStacking == cssc::StackingDirection_NO_STACKING) && Is3dWallChart() ) + if( (eStacking == cssc2::StackingDirection_NO_STACKING) && Is3dWallChart() ) mxChart3d->SetClustered(); // varied point colors @@ -2396,7 +2534,8 @@ bool XclExpChTypeGroup::CreateStockSeries( Reference< XDataSeries > xDataSeries, void XclExpChTypeGroup::WriteBody( XclExpStream& rStrm ) { - rStrm << maData.maRect << maData.mnFlags << maData.mnGroupIdx; + rStrm.WriteZeroBytes( 16 ); + rStrm << maData.mnFlags << maData.mnGroupIdx; } // Axes ======================================================================= @@ -2421,7 +2560,6 @@ void XclExpChLabelRange::Convert( const ScaleData& rScaleData, bool bMirrorOrien void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet ) { - namespace cssc = ::com::sun::star::chart; cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE; rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ); double fCrossingPos = 1.0; @@ -2479,13 +2617,11 @@ void XclExpChValueRange::Convert( const ScaleData& rScaleData ) ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMINOR, bAutoMinor ); // reverse order - namespace cssc = ::com::sun::star::chart2; - ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_REVERSE, rScaleData.Orientation == cssc::AxisOrientation_REVERSE ); + ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_REVERSE, rScaleData.Orientation == cssc2::AxisOrientation_REVERSE ); } void XclExpChValueRange::ConvertAxisPosition( const ScfPropertySet& rPropSet ) { - namespace cssc = ::com::sun::star::chart; cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE; double fCrossingPos = 0.0; if( rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ) && rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE ) ) @@ -2569,7 +2705,6 @@ void XclExpChTick::Convert( const ScfPropertySet& rPropSet, const XclChExtTypeIn } else { - namespace cssc = ::com::sun::star::chart; cssc::ChartAxisLabelPosition eApiLabelPos = cssc::ChartAxisLabelPosition_NEAR_AXIS; rPropSet.GetProperty( eApiLabelPos, EXC_CHPROP_LABELPOSITION ); switch( eApiLabelPos ) @@ -2602,9 +2737,9 @@ void XclExpChTick::WriteBody( XclExpStream& rStrm ) rStrm << maData.mnMajor << maData.mnMinor << maData.mnLabelPos - << maData.mnBackMode - << maData.maRect - << maData.maTextColor + << maData.mnBackMode; + rStrm.WriteZeroBytes( 16 ); + rStrm << maData.maTextColor << maData.mnFlags; if( GetBiff() == EXC_BIFF8 ) rStrm << GetPalette().GetColorIndex( mnTextColorId ) << maData.mnRotation; @@ -2758,7 +2893,8 @@ void XclExpChAxis::WriteSubRecords( XclExpStream& rStrm ) void XclExpChAxis::WriteBody( XclExpStream& rStrm ) { - rStrm << maData.mnType << maData.maRect; + rStrm << maData.mnType; + rStrm.WriteZeroBytes( 16 ); } // ---------------------------------------------------------------------------- @@ -2903,6 +3039,28 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16 } } + // inner and outer plot area position and size + try + { + Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); + Reference< ::com::sun::star::chart::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW ); + // set manual flag in chart data + if( !xPositioning->isAutomaticDiagramPositioning() ) + GetChartData().SetManualPlotArea(); + // the CHAXESSET record contains the inner plot area + maData.maRect = CalcChartRectFromHmm( xPositioning->calculateDiagramPositionExcludingAxes() ); + // the embedded CHFRAMEPOS record contains the outer plot area + mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_PARENT, EXC_CHFRAMEPOS_PARENT ) ); + // for pie charts, always use inner plot area size to exclude the data labels as Excel does + const XclExpChTypeGroup* pFirstTypeGroup = GetFirstTypeGroup().get(); + bool bPieChart = pFirstTypeGroup && (pFirstTypeGroup->GetTypeInfo().meTypeCateg == EXC_CHTYPECATEG_PIE); + mxFramePos->GetFramePosData().maRect = bPieChart ? maData.maRect : + CalcChartRectFromHmm( xPositioning->calculateDiagramPositionIncludingAxes() ); + } + catch( Exception& ) + { + } + // return first unused chart type group index for next axes set return nGroupIdx; } @@ -2915,14 +3073,7 @@ bool XclExpChAxesSet::Is3dChart() const void XclExpChAxesSet::WriteSubRecords( XclExpStream& rStrm ) { - /* Need to set a reasonable size for the plot area, otherwise Excel will - move away embedded shapes while auto-sizing the plot area. This is just - a wild guess, but will be fixed with implementing manual positioning of - chart elements. */ - rStrm.StartRecord( EXC_ID_CHFRAMEPOS, 20 ); - rStrm << sal_uInt16(2) << sal_uInt16(2) << sal_uInt32(66) << sal_uInt32(626) << sal_uInt32(3384) << sal_uInt32(3231); - rStrm.EndRecord(); - + lclSaveRecord( rStrm, mxFramePos ); lclSaveRecord( rStrm, mxXAxis ); lclSaveRecord( rStrm, mxYAxis ); lclSaveRecord( rStrm, mxZAxis ); @@ -2974,10 +3125,10 @@ void XclExpChAxesSet::WriteBody( XclExpStream& rStrm ) // The chart object =========================================================== XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, - Reference< XChartDocument > xChartDoc, const Size& rSize ) : - XclExpChGroupBase( XclExpChRoot( rRoot, this ), EXC_CHFRBLOCK_TYPE_CHART, EXC_ID_CHCHART, 16 ) + Reference< XChartDocument > xChartDoc, const Rectangle& rChartRect ) : + XclExpChGroupBase( XclExpChRoot( rRoot, *this ), EXC_CHFRBLOCK_TYPE_CHART, EXC_ID_CHCHART, 16 ) { - Size aPtSize = OutputDevice::LogicToLogic( rSize, MapMode( MAP_100TH_MM ), MapMode( MAP_POINT ) ); + Size aPtSize = OutputDevice::LogicToLogic( rChartRect.GetSize(), MapMode( MAP_100TH_MM ), MapMode( MAP_POINT ) ); // rectangle is stored in 16.16 fixed-point format maRect.mnX = maRect.mnY = 0; maRect.mnWidth = static_cast< sal_Int32 >( aPtSize.Width() << 16 ); @@ -3001,8 +3152,8 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, bool bIncludeHidden = aDiagramProp.GetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS ); ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY, !bIncludeHidden ); - // initialize API conversion (remembers xChartDoc internally) - InitConversion( xChartDoc ); + // initialize API conversion (remembers xChartDoc and rChartRect internally) + InitConversion( xChartDoc, rChartRect ); // chart frame ScfPropertySet aFrameProp( xChartDoc->getPageBackground() ); @@ -3060,6 +3211,13 @@ void XclExpChChart::SetDataLabel( XclExpChTextRef xText ) maLabels.AppendRecord( xText ); } +void XclExpChChart::SetManualPlotArea() +{ + // this flag does not exist in BIFF5 + if( GetBiff() == EXC_BIFF8 ) + ::set_flag( maProps.mnFlags, EXC_CHPROPS_USEMANPLOTAREA ); +} + void XclExpChChart::WriteSubRecords( XclExpStream& rStrm ) { // background format @@ -3105,7 +3263,7 @@ XclExpChartDrawing::XclExpChartDrawing( const XclExpRoot& rRoot, /* Create a new independent object manager with own DFF stream for the DGCONTAINER, pass global manager as parent for shared usage of global DFF data (picture container etc.). */ - mxObjMgr.reset( new XclExpEmbeddedObjectManager( GetObjectManager(), rChartSize, EXC_CHART_UNIT, EXC_CHART_UNIT ) ); + mxObjMgr.reset( new XclExpEmbeddedObjectManager( GetObjectManager(), rChartSize, EXC_CHART_TOTALUNITS, EXC_CHART_TOTALUNITS ) ); // initialize the drawing object list mxObjMgr->StartSheet(); // process the draw page (convert all shapes) @@ -3128,17 +3286,17 @@ void XclExpChartDrawing::Save( XclExpStream& rStrm ) // ---------------------------------------------------------------------------- -XclExpChart::XclExpChart( const XclExpRoot& rRoot, Reference< XModel > xModel, const Size& rSize ) : +XclExpChart::XclExpChart( const XclExpRoot& rRoot, Reference< XModel > xModel, const Rectangle& rChartRect ) : XclExpSubStream( EXC_BOF_CHART ), XclExpRoot( rRoot ) { AppendNewRecord( new XclExpChartPageSettings( rRoot ) ); AppendNewRecord( new XclExpBoolRecord( EXC_ID_PROTECT, false ) ); - AppendNewRecord( new XclExpChartDrawing( rRoot, xModel, rSize ) ); + AppendNewRecord( new XclExpChartDrawing( rRoot, xModel, rChartRect.GetSize() ) ); AppendNewRecord( new XclExpUInt16Record( EXC_ID_CHUNITS, EXC_CHUNITS_TWIPS ) ); Reference< XChartDocument > xChartDoc( xModel, UNO_QUERY ); - AppendNewRecord( new XclExpChChart( rRoot, xChartDoc, rSize ) ); + AppendNewRecord( new XclExpChChart( rRoot, xChartDoc, rChartRect ) ); } // ============================================================================ diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 2df531a9b932..a4b5864668b4 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -956,8 +956,8 @@ XclExpChartObj::XclExpChartObj( XclExpObjectManager& rObjMgr, Reference< XShape aShapeProp.GetProperty( xModel, CREATE_OUSTRING( "Model" ) ); ::com::sun::star::awt::Rectangle aBoundRect; aShapeProp.GetProperty( aBoundRect, CREATE_OUSTRING( "BoundRect" ) ); - Size aSize( aBoundRect.Width, aBoundRect.Height ); - mxChart.reset( new XclExpChart( GetRoot(), xModel, aSize ) ); + Rectangle aChartRect( Point( aBoundRect.X, aBoundRect.Y ), Size( aBoundRect.Width, aBoundRect.Height ) ); + mxChart.reset( new XclExpChart( GetRoot(), xModel, aChartRect ) ); } XclExpChartObj::~XclExpChartObj() diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 6734f90948e4..428bbe2d4f82 100644..100755 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -37,12 +37,14 @@ #include <com/sun/star/drawing/Direction3D.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -57,8 +59,11 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> +#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> +#include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -98,36 +103,41 @@ using ::com::sun::star::frame::XModel; using ::com::sun::star::util::XNumberFormatsSupplier; using ::com::sun::star::drawing::XDrawPage; using ::com::sun::star::drawing::XDrawPageSupplier; +using ::com::sun::star::drawing::XShape; +using ::com::sun::star::chart2::IncrementData; +using ::com::sun::star::chart2::RelativePosition; +using ::com::sun::star::chart2::ScaleData; +using ::com::sun::star::chart2::SubIncrement; +using ::com::sun::star::chart2::XAxis; using ::com::sun::star::chart2::XChartDocument; -using ::com::sun::star::chart2::XDiagram; -using ::com::sun::star::chart2::XCoordinateSystemContainer; -using ::com::sun::star::chart2::XCoordinateSystem; -using ::com::sun::star::chart2::XChartTypeContainer; using ::com::sun::star::chart2::XChartType; -using ::com::sun::star::chart2::XDataSeriesContainer; +using ::com::sun::star::chart2::XChartTypeContainer; +using ::com::sun::star::chart2::XCoordinateSystem; +using ::com::sun::star::chart2::XCoordinateSystemContainer; using ::com::sun::star::chart2::XDataSeries; +using ::com::sun::star::chart2::XDataSeriesContainer; +using ::com::sun::star::chart2::XDiagram; +using ::com::sun::star::chart2::XFormattedString; +using ::com::sun::star::chart2::XLegend; using ::com::sun::star::chart2::XRegressionCurve; using ::com::sun::star::chart2::XRegressionCurveContainer; -using ::com::sun::star::chart2::XAxis; using ::com::sun::star::chart2::XScaling; -using ::com::sun::star::chart2::ScaleData; -using ::com::sun::star::chart2::IncrementData; -using ::com::sun::star::chart2::SubIncrement; -using ::com::sun::star::chart2::XLegend; -using ::com::sun::star::chart2::XTitled; using ::com::sun::star::chart2::XTitle; -using ::com::sun::star::chart2::XFormattedString; +using ::com::sun::star::chart2::XTitled; using ::com::sun::star::chart2::data::XDataProvider; using ::com::sun::star::chart2::data::XDataReceiver; +using ::com::sun::star::chart2::data::XDataSequence; using ::com::sun::star::chart2::data::XDataSink; using ::com::sun::star::chart2::data::XLabeledDataSequence; -using ::com::sun::star::chart2::data::XDataSequence; using ::formula::FormulaToken; using ::formula::StackVar; +namespace cssc = ::com::sun::star::chart; +namespace cssc2 = ::com::sun::star::chart2; + // Helpers ==================================================================== namespace { @@ -158,28 +168,18 @@ void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bC // Common ===================================================================== /** Stores global data needed in various classes of the Chart import filter. */ -class XclImpChRootData : public XclChRootData +struct XclImpChRootData : public XclChRootData { -public: - explicit XclImpChRootData( XclImpChChart* pChartData ); + XclImpChChart& mrChartData; /// The chart data object. - /** Returns a reference to the parent chart data object. */ - inline XclImpChChart& GetChartData() const { return *mpChartData; } - -private: - XclImpChChart* mpChartData; /// Pointer to the chart data object. + inline explicit XclImpChRootData( XclImpChChart& rChartData ) : mrChartData( rChartData ) {} }; -XclImpChRootData::XclImpChRootData( XclImpChChart* pChartData ) : - mpChartData( pChartData ) -{ -} - // ---------------------------------------------------------------------------- -XclImpChRoot::XclImpChRoot( const XclImpRoot& rRoot, XclImpChChart* pChartData ) : +XclImpChRoot::XclImpChRoot( const XclImpRoot& rRoot, XclImpChChart& rChartData ) : XclImpRoot( rRoot ), - mxChData( new XclImpChRootData( pChartData ) ) + mxChData( new XclImpChRootData( rChartData ) ) { } @@ -189,22 +189,22 @@ XclImpChRoot::~XclImpChRoot() XclImpChChart& XclImpChRoot::GetChartData() const { - return mxChData->GetChartData(); + return mxChData->mrChartData; } const XclChTypeInfo& XclImpChRoot::GetChartTypeInfo( XclChTypeId eType ) const { - return mxChData->GetTypeInfoProvider().GetTypeInfo( eType ); + return mxChData->mxTypeInfoProv->GetTypeInfo( eType ); } const XclChTypeInfo& XclImpChRoot::GetChartTypeInfo( sal_uInt16 nRecId ) const { - return mxChData->GetTypeInfoProvider().GetTypeInfoFromRecId( nRecId ); + return mxChData->mxTypeInfoProv->GetTypeInfoFromRecId( nRecId ); } const XclChFormatInfo& XclImpChRoot::GetFormatInfo( XclChObjectType eObjType ) const { - return mxChData->GetFormatInfoProvider().GetFormatInfo( eObjType ); + return mxChData->mxFmtInfoProv->GetFormatInfo( eObjType ); } Color XclImpChRoot::GetFontAutoColor() const @@ -225,10 +225,10 @@ Color XclImpChRoot::GetSeriesFillAutoColor( sal_uInt16 nFormatIdx ) const return ScfTools::GetMixedColor( aColor, rPal.GetColor( EXC_COLOR_CHWINDOWBACK ), nTrans ); } -void XclImpChRoot::InitConversion( Reference< XChartDocument > xChartDoc ) const +void XclImpChRoot::InitConversion( Reference< XChartDocument > xChartDoc, const Rectangle& rChartRect ) const { // create formatting object tables - mxChData->InitConversion( xChartDoc ); + mxChData->InitConversion( GetRoot(), xChartDoc, rChartRect ); // lock the model to suppress any internal updates Reference< XModel > xModel( xChartDoc, UNO_QUERY ); @@ -255,7 +255,7 @@ void XclImpChRoot::FinishConversion( XclImpDffConverter& rDffConv ) const { rDffConv.Progress( EXC_CHART_PROGRESS_SIZE ); // unlock the model - Reference< XModel > xModel( mxChData->GetChartDoc(), UNO_QUERY ); + Reference< XModel > xModel( mxChData->mxChartDoc, UNO_QUERY ); if( xModel.is() ) xModel->unlockControllers(); rDffConv.Progress( EXC_CHART_PROGRESS_SIZE ); @@ -265,14 +265,48 @@ void XclImpChRoot::FinishConversion( XclImpDffConverter& rDffConv ) const Reference< XDataProvider > XclImpChRoot::GetDataProvider() const { - return mxChData->GetChartDoc()->getDataProvider(); + return mxChData->mxChartDoc->getDataProvider(); +} + +Reference< XShape > XclImpChRoot::GetTitleShape( const XclChTextKey& rTitleKey ) const +{ + return mxChData->GetTitleShape( rTitleKey ); +} + +sal_Int32 XclImpChRoot::CalcHmmFromChartX( sal_Int32 nPosX ) const +{ + return static_cast< sal_Int32 >( mxChData->mfUnitSizeX * nPosX + mxChData->mnBorderGapX + 0.5 ); +} + +sal_Int32 XclImpChRoot::CalcHmmFromChartY( sal_Int32 nPosY ) const +{ + return static_cast< sal_Int32 >( mxChData->mfUnitSizeY * nPosY + mxChData->mnBorderGapY + 0.5 ); +} + +::com::sun::star::awt::Rectangle XclImpChRoot::CalcHmmFromChartRect( const XclChRectangle& rRect ) const +{ + return ::com::sun::star::awt::Rectangle( + CalcHmmFromChartX( rRect.mnX ), + CalcHmmFromChartY( rRect.mnY ), + CalcHmmFromChartX( rRect.mnWidth ), + CalcHmmFromChartY( rRect.mnHeight ) ); +} + +double XclImpChRoot::CalcRelativeFromChartX( sal_Int32 nPosX ) const +{ + return static_cast< double >( CalcHmmFromChartX( nPosX ) ) / mxChData->maChartRect.GetWidth(); +} + +double XclImpChRoot::CalcRelativeFromChartY( sal_Int32 nPosY ) const +{ + return static_cast< double >( CalcHmmFromChartY( nPosY ) ) / mxChData->maChartRect.GetHeight(); } void XclImpChRoot::ConvertLineFormat( ScfPropertySet& rPropSet, const XclChLineFormat& rLineFmt, XclChPropertyMode ePropMode ) const { GetChartPropSetHelper().WriteLineProperties( - rPropSet, mxChData->GetLineDashTable(), rLineFmt, ePropMode ); + rPropSet, *mxChData->mxLineDashTable, rLineFmt, ePropMode ); } void XclImpChRoot::ConvertAreaFormat( ScfPropertySet& rPropSet, @@ -286,7 +320,7 @@ void XclImpChRoot::ConvertEscherFormat( ScfPropertySet& rPropSet, XclChPropertyMode ePropMode ) const { GetChartPropSetHelper().WriteEscherProperties( rPropSet, - mxChData->GetGradientTable(), mxChData->GetHatchTable(), mxChData->GetBitmapTable(), + *mxChData->mxGradientTable, *mxChData->mxHatchTable, *mxChData->mxBitmapTable, rEscherFmt, rPicFmt, ePropMode ); } @@ -357,7 +391,13 @@ void XclImpChGroupBase::SkipBlock( XclImpStream& rStrm ) void XclImpChFramePos::ReadChFramePos( XclImpStream& rStrm ) { - rStrm >> maData.mnObjType >> maData.mnSizeMode >> maData.maRect; + rStrm >> maData.mnTLMode >> maData.mnBRMode; + /* According to the spec, the upper 16 bits of all members in the + rectangle are unused and may contain garbage. */ + maData.maRect.mnX = rStrm.ReadInt16(); rStrm.Ignore( 2 ); + maData.maRect.mnY = rStrm.ReadInt16(); rStrm.Ignore( 2 ); + maData.maRect.mnWidth = rStrm.ReadInt16(); rStrm.Ignore( 2 ); + maData.maRect.mnHeight = rStrm.ReadInt16(); rStrm.Ignore( 2 ); } // ---------------------------------------------------------------------------- @@ -862,9 +902,7 @@ void XclImpChText::ReadHeaderRecord( XclImpStream& rStrm ) // #116397# BIFF8: index into palette used instead of RGB data maData.maTextColor = GetPalette().GetColor( rStrm.ReaduInt16() ); // placement and rotation - rStrm >> maData.mnPlacement >> maData.mnRotation; - // lower 4 bits used for placement, other bits contain garbage - maData.mnPlacement &= 0x000F; + rStrm >> maData.mnFlags2 >> maData.mnRotation; } else { @@ -878,6 +916,10 @@ void XclImpChText::ReadSubRecord( XclImpStream& rStrm ) { switch( rStrm.GetRecId() ) { + case EXC_ID_CHFRAMEPOS: + mxFramePos.reset( new XclImpChFramePos ); + mxFramePos->ReadChFramePos( rStrm ); + break; case EXC_ID_CHFONT: mxFont.reset( new XclImpChFont ); mxFont->ReadChFont( rStrm ); @@ -1002,8 +1044,7 @@ void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeIn bool bShowSymbol = bShowAny && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL ); // create API struct for label values, set API label separator - namespace cssc = ::com::sun::star::chart2; - cssc::DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol ); + cssc2::DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol ); rPropSet.SetProperty( EXC_CHPROP_LABEL, aPointLabel ); String aSep = mxLabelProps.is() ? mxLabelProps->maSeparator : String( sal_Unicode( '\n' ) ); if( aSep.Len() == 0 ) @@ -1016,9 +1057,9 @@ void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeIn ConvertFont( rPropSet ); ConvertRotation( rPropSet, false ); // label placement - using namespace ::com::sun::star::chart::DataLabelPlacement; + using namespace cssc::DataLabelPlacement; sal_Int32 nPlacement = rTypeInfo.mnDefaultLabelPos; - switch( maData.mnPlacement ) + switch( ::extract_value< sal_uInt16 >( maData.mnFlags2, 0, 4 ) ) { case EXC_CHTEXT_POS_DEFAULT: nPlacement = rTypeInfo.mnDefaultLabelPos; break; case EXC_CHTEXT_POS_OUTSIDE: nPlacement = OUTSIDE; break; @@ -1064,6 +1105,62 @@ Reference< XTitle > XclImpChText::CreateTitle() const return xTitle; } +void XclImpChText::ConvertTitlePosition( const XclChTextKey& rTitleKey ) const +{ + if( !mxFramePos ) return; + + const XclChFramePos& rPosData = mxFramePos->GetFramePosData(); + OSL_ENSURE( (rPosData.mnTLMode == EXC_CHFRAMEPOS_PARENT) && (rPosData.mnBRMode == EXC_CHFRAMEPOS_PARENT), + "XclImpChText::ConvertTitlePosition - unexpected frame position mode" ); + + /* Check if title is moved manually. To get the actual position of the + title, we do some kind of hack and use the values from the CHTEXT + record, effectively ignoring the contents of the CHFRAMEPOS record + which contains the position relative to the default title position + (according to the spec, the CHFRAMEPOS supersedes the CHTEXT record). + Especially when it comes to axis titles, things would become very + complicated here, because the relative title position is stored in a + measurement unit that is dependent on the size of the inner plot area, + the interpretation of the X and Y coordinate is dependent on the + direction of the axis, and in 3D charts, and the title default + positions are dependent on the 3D view settings (rotation, elevation, + and perspective). Thus, it is easier to assume that the creator has + written out the correct absolute position and size of the title in the + CHTEXT record. This is assured by checking that the shape size stored + in the CHTEXT record is non-zero. */ + if( (rPosData.mnTLMode == EXC_CHFRAMEPOS_PARENT) && + ((rPosData.maRect.mnX != 0) || (rPosData.maRect.mnY != 0)) && + (maData.maRect.mnWidth > 0) && (maData.maRect.mnHeight > 0) ) try + { + Reference< XShape > xTitleShape( GetTitleShape( rTitleKey ), UNO_SET_THROW ); + // the call to XShape.getSize() may recalc the chart view + ::com::sun::star::awt::Size aTitleSize = xTitleShape->getSize(); + // rotated titles need special handling... + sal_Int32 nScRot = XclTools::GetScRotation( GetRotation(), 0 ); + double fRad = nScRot * F_PI18000; + double fSin = fabs( sin( fRad ) ); + double fCos = fabs( cos( fRad ) ); + ::com::sun::star::awt::Size aBoundSize( + static_cast< sal_Int32 >( fCos * aTitleSize.Width + fSin * aTitleSize.Height + 0.5 ), + static_cast< sal_Int32 >( fSin * aTitleSize.Width + fCos * aTitleSize.Height + 0.5 ) ); + // calculate the title position from the values in the CHTEXT record + ::com::sun::star::awt::Point aTitlePos( + CalcHmmFromChartX( maData.maRect.mnX ), + CalcHmmFromChartY( maData.maRect.mnY ) ); + // add part of height to X direction, if title is rotated down (clockwise) + if( nScRot > 18000 ) + aTitlePos.X += static_cast< sal_Int32 >( fSin * aTitleSize.Height + 0.5 ); + // add part of width to Y direction, if title is rotated up (counterclockwise) + else if( nScRot > 0 ) + aTitlePos.Y += static_cast< sal_Int32 >( fSin * aTitleSize.Width + 0.5 ); + // set the resulting position at the title shape + xTitleShape->setPosition( aTitlePos ); + } + catch( Exception& ) + { + } +} + void XclImpChText::ReadChFrLabelProps( XclImpStream& rStrm ) { if( GetBiff() == EXC_BIFF8 ) @@ -1087,12 +1184,14 @@ void lclUpdateText( XclImpChTextRef& rxText, XclImpChTextRef xDefText ) rxText = xDefText; } -void lclFinalizeTitle( XclImpChTextRef& rxTitle, XclImpChTextRef xDefText ) +void lclFinalizeTitle( XclImpChTextRef& rxTitle, XclImpChTextRef xDefText, const String& rAutoTitle ) { /* Do not update a title, if it is not visible (if rxTitle is null). Existing reference indicates enabled title. */ if( rxTitle.is() ) { + if( !rxTitle->HasString() ) + rxTitle->SetString( rAutoTitle ); if( rxTitle->HasString() ) rxTitle->UpdateText( xDefText.get() ); else @@ -1544,7 +1643,6 @@ Reference< XPropertySet > XclImpChSerErrorBar::CreateErrorBar( const XclImpChSer aBarProp.SetBoolProperty( EXC_CHPROP_SHOWNEGATIVEERROR, pNegBar != 0 ); // type of displayed error - namespace cssc = ::com::sun::star::chart; switch( pPrimaryBar->maData.mnSourceType ) { case EXC_CHSERERR_PERCENT: @@ -2281,6 +2379,10 @@ void XclImpChLegend::ReadSubRecord( XclImpStream& rStrm ) { switch( rStrm.GetRecId() ) { + case EXC_ID_CHFRAMEPOS: + mxFramePos.reset( new XclImpChFramePos ); + mxFramePos->ReadChFramePos( rStrm ); + break; case EXC_ID_CHTEXT: mxText.reset( new XclImpChText( GetChRoot() ) ); mxText->ReadRecordGroup( rStrm ); @@ -2307,6 +2409,7 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const if( xLegend.is() ) { ScfPropertySet aLegendProp( xLegend ); + aLegendProp.SetBoolProperty( EXC_CHPROP_SHOW, true ); // frame properties if( mxFrame.is() ) @@ -2314,8 +2417,69 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const // text properties if( mxText.is() ) mxText->ConvertFont( aLegendProp ); - // special legend properties - GetChartPropSetHelper().WriteLegendProperties( aLegendProp, maData ); + + /* Legend position and size. Default positions are used only if the + plot area is positioned automatically (Excel sets the plot area to + manual mode, if the legend is moved or resized). With manual plot + areas, Excel ignores the value in maData.mnDockMode completely. */ + cssc2::LegendPosition eApiPos = cssc2::LegendPosition_CUSTOM; + cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; + if( !GetChartData().IsManualPlotArea() ) switch( maData.mnDockMode ) + { + case EXC_CHLEGEND_LEFT: eApiPos = cssc2::LegendPosition_LINE_START; eApiExpand = cssc2::LegendExpansion_HIGH; break; + case EXC_CHLEGEND_RIGHT: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; + case EXC_CHLEGEND_TOP: eApiPos = cssc2::LegendPosition_PAGE_START; eApiExpand = cssc2::LegendExpansion_WIDE; break; + case EXC_CHLEGEND_BOTTOM: eApiPos = cssc2::LegendPosition_PAGE_END; eApiExpand = cssc2::LegendExpansion_WIDE; break; + // top-right not supported + case EXC_CHLEGEND_CORNER: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; + } + + // no automatic position: try to find the correct position and size + if( eApiPos == cssc2::LegendPosition_CUSTOM ) + { + const XclChFramePos* pFramePos = mxFramePos.is() ? &mxFramePos->GetFramePosData() : 0; + + /* Legend position. Only the settings from the CHFRAMEPOS record + are used by Excel, the position in the CHLEGEND record will be + ignored. */ + if( pFramePos ) + { + RelativePosition aRelPos; + aRelPos.Primary = CalcRelativeFromChartX( pFramePos->maRect.mnX ); + aRelPos.Secondary = CalcRelativeFromChartY( pFramePos->maRect.mnY ); + aRelPos.Anchor = ::com::sun::star::drawing::Alignment_TOP_LEFT; + aLegendProp.SetProperty( EXC_CHPROP_RELATIVEPOSITION, aRelPos ); + } + else + { + // no manual position found, just go for the default + eApiPos = cssc2::LegendPosition_LINE_END; + } + + + /* Legend size. #i71697# It is not possible to set the legend size + directly in the Chart, do some magic here. */ + if( !pFramePos || (pFramePos->mnBRMode != EXC_CHFRAMEPOS_ABSSIZE_POINTS) || + (pFramePos->maRect.mnWidth == 0) || (pFramePos->maRect.mnHeight == 0) ) + { + // automatic size: determine entry direction from flags + eApiExpand = ::get_flagvalue( maData.mnFlags, EXC_CHLEGEND_STACKED, + cssc2::LegendExpansion_HIGH, cssc2::LegendExpansion_WIDE ); + } + else + { + // legend size is given in points, not in chart units + double fRatio = static_cast< double >( pFramePos->maRect.mnWidth ) / pFramePos->maRect.mnHeight; + if( fRatio > 1.5 ) + eApiExpand = cssc2::LegendExpansion_WIDE; + else if( fRatio < 0.75 ) + eApiExpand = cssc2::LegendExpansion_HIGH; + else + eApiExpand = cssc2::LegendExpansion_BALANCED; + } + } + aLegendProp.SetProperty( EXC_CHPROP_ANCHORPOSITION, eApiPos ); + aLegendProp.SetProperty( EXC_CHPROP_EXPANSION, eApiExpand ); } return xLegend; } @@ -2358,7 +2522,8 @@ XclImpChTypeGroup::XclImpChTypeGroup( const XclImpChRoot& rRoot ) : void XclImpChTypeGroup::ReadHeaderRecord( XclImpStream& rStrm ) { - rStrm >> maData.maRect >> maData.mnFlags >> maData.mnGroupIdx; + rStrm.Ignore( 16 ); + rStrm >> maData.mnFlags >> maData.mnGroupIdx; } void XclImpChTypeGroup::ReadSubRecord( XclImpStream& rStrm ) @@ -2548,13 +2713,12 @@ void XclImpChTypeGroup::InsertDataSeries( Reference< XChartType > xChartType, if( xSeriesCont.is() && xSeries.is() ) { // series stacking mode - namespace cssc = ::com::sun::star::chart2; - cssc::StackingDirection eStacking = cssc::StackingDirection_NO_STACKING; + cssc2::StackingDirection eStacking = cssc2::StackingDirection_NO_STACKING; // stacked overrides deep-3d if( maType.IsStacked() || maType.IsPercent() ) - eStacking = cssc::StackingDirection_Y_STACKING; + eStacking = cssc2::StackingDirection_Y_STACKING; else if( Is3dDeepChart() ) - eStacking = cssc::StackingDirection_Z_STACKING; + eStacking = cssc2::StackingDirection_Z_STACKING; // additional series properties ScfPropertySet aSeriesProp( xSeries ); @@ -2674,11 +2838,9 @@ void XclImpChLabelRange::Convert( ScfPropertySet& rPropSet, ScaleData& rScaleDat // do not break text into several lines unless all labels are visible rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maData.mnLabelFreq == 1 ); // do not stagger labels in two lines - namespace cssc = ::com::sun::star::chart; rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE ); // reverse order - namespace cssc2 = ::com::sun::star::chart2; bool bReverse = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient; rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL; @@ -2692,7 +2854,6 @@ void XclImpChLabelRange::ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3d But: the Y axis has to be moved to "end", if the X axis is mirrored, to keep it at the left end of the chart. */ bool bMaxCross = ::get_flag( maData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS ); - namespace cssc = ::com::sun::star::chart; cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE; rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos ); @@ -2756,7 +2917,6 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co } // reverse order - namespace cssc2 = ::com::sun::star::chart2; bool bReverse = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_REVERSE ) != bMirrorOrient; rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL; } @@ -2768,7 +2928,6 @@ void XclImpChValueRange::ConvertAxisPosition( ScfPropertySet& rPropSet ) const bool bLogScale = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE ); // crossing mode (max-cross flag overrides other crossing settings) - namespace cssc = ::com::sun::star::chart; cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE; rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos ); @@ -2791,7 +2950,7 @@ sal_Int32 lclGetApiTickmarks( sal_uInt8 nXclTickPos ) return nApiTickmarks; } -::com::sun::star::chart::ChartAxisLabelPosition lclGetApiLabelPosition( sal_Int8 nXclLabelPos ) +cssc::ChartAxisLabelPosition lclGetApiLabelPosition( sal_Int8 nXclLabelPos ) { using namespace ::com::sun::star::chart; switch( nXclLabelPos ) @@ -2815,9 +2974,9 @@ void XclImpChTick::ReadChTick( XclImpStream& rStrm ) rStrm >> maData.mnMajor >> maData.mnMinor >> maData.mnLabelPos - >> maData.mnBackMode - >> maData.maRect - >> maData.maTextColor + >> maData.mnBackMode; + rStrm.Ignore( 16 ); + rStrm >> maData.maTextColor >> maData.mnFlags; if( GetBiff() == EXC_BIFF8 ) @@ -2850,7 +3009,7 @@ void XclImpChTick::Convert( ScfPropertySet& rPropSet ) const rPropSet.SetProperty( EXC_CHPROP_MAJORTICKS, lclGetApiTickmarks( maData.mnMajor ) ); rPropSet.SetProperty( EXC_CHPROP_MINORTICKS, lclGetApiTickmarks( maData.mnMinor ) ); rPropSet.SetProperty( EXC_CHPROP_LABELPOSITION, lclGetApiLabelPosition( maData.mnLabelPos ) ); - rPropSet.SetProperty( EXC_CHPROP_MARKPOSITION, ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS ); + rPropSet.SetProperty( EXC_CHPROP_MARKPOSITION, cssc::ChartAxisMarkPosition_AT_AXIS ); } // ---------------------------------------------------------------------------- @@ -2864,7 +3023,7 @@ XclImpChAxis::XclImpChAxis( const XclImpChRoot& rRoot, sal_uInt16 nAxisType ) : void XclImpChAxis::ReadHeaderRecord( XclImpStream& rStrm ) { - rStrm >> maData.mnType >> maData.maRect; + rStrm >> maData.mnType; } void XclImpChAxis::ReadSubRecord( XclImpStream& rStrm ) @@ -2941,8 +3100,6 @@ sal_uInt16 XclImpChAxis::GetRotation() const Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup, const XclImpChAxis* pCrossingAxis ) const { - namespace cssc2 = ::com::sun::star::chart2; - // create the axis object (always) Reference< XAxis > xAxis( ScfApiHelper::CreateInstance( SERVICE_CHART2_AXIS ), UNO_QUERY ); if( xAxis.is() ) @@ -3136,8 +3293,8 @@ void XclImpChAxesSet::ReadSubRecord( XclImpStream& rStrm ) switch( rStrm.GetRecId() ) { case EXC_ID_CHFRAMEPOS: - mxPos.reset( new XclImpChFramePos ); - mxPos->ReadChFramePos( rStrm ); + mxFramePos.reset( new XclImpChFramePos ); + mxFramePos->ReadChFramePos( rStrm ); break; case EXC_ID_CHAXIS: ReadChAxis( rStrm ); @@ -3188,9 +3345,10 @@ void XclImpChAxesSet::Finalize() // finalize axis titles XclImpChTextRef xDefText = GetChartData().GetDefaultText( EXC_CHTEXTTYPE_AXISTITLE ); - lclFinalizeTitle( mxXAxisTitle, xDefText ); - lclFinalizeTitle( mxYAxisTitle, xDefText ); - lclFinalizeTitle( mxZAxisTitle, xDefText ); + String aAutoTitle = CREATE_STRING( "Axis Title" ); + lclFinalizeTitle( mxXAxisTitle, xDefText, aAutoTitle ); + lclFinalizeTitle( mxYAxisTitle, xDefText, aAutoTitle ); + lclFinalizeTitle( mxZAxisTitle, xDefText, aAutoTitle ); // #i47745# missing plot frame -> invisible border and area if( !mxPlotFrame ) @@ -3252,6 +3410,16 @@ void XclImpChAxesSet::Convert( Reference< XDiagram > xDiagram ) const } } +void XclImpChAxesSet::ConvertTitlePositions() const +{ + if( mxXAxisTitle.is() ) + mxXAxisTitle->ConvertTitlePosition( XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, maData.mnAxesSetId, EXC_CHAXIS_X ) ); + if( mxYAxisTitle.is() ) + mxYAxisTitle->ConvertTitlePosition( XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, maData.mnAxesSetId, EXC_CHAXIS_Y ) ); + if( mxZAxisTitle.is() ) + mxZAxisTitle->ConvertTitlePosition( XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, maData.mnAxesSetId, EXC_CHAXIS_Z ) ); +} + void XclImpChAxesSet::ReadChAxis( XclImpStream& rStrm ) { XclImpChAxisRef xAxis( new XclImpChAxis( GetChRoot() ) ); @@ -3358,11 +3526,15 @@ void XclImpChAxesSet::ConvertAxis( if( xAxis.is() ) { // create and attach the axis title - if( xChAxisTitle.is() ) + if( xChAxisTitle.is() ) try { - Reference< XTitled > xTitled( xAxis, UNO_QUERY ); - if( xTitled.is() ) - xTitled->setTitleObject( xChAxisTitle->CreateTitle() ); + Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW ); + Reference< XTitle > xTitle( xChAxisTitle->CreateTitle(), UNO_SET_THROW ); + xTitled->setTitleObject( xTitle ); + } + catch( Exception& ) + { + DBG_ERRORFILE( "XclImpChAxesSet::ConvertAxis - cannot set axis title" ); } // insert axis into coordinate system @@ -3416,7 +3588,7 @@ void XclImpChAxesSet::ConvertBackground( Reference< XDiagram > xDiagram ) const // The chart object =========================================================== XclImpChChart::XclImpChChart( const XclImpRoot& rRoot ) : - XclImpChRoot( rRoot, this ) + XclImpChRoot( rRoot, *this ) { mxPrimAxesSet.reset( new XclImpChAxesSet( GetChRoot(), EXC_CHAXESSET_PRIMARY ) ); mxSecnAxesSet.reset( new XclImpChAxesSet( GetChRoot(), EXC_CHAXESSET_SECONDARY ) ); @@ -3516,23 +3688,34 @@ XclImpChTextRef XclImpChChart::GetDefaultText( XclChTextType eTextType ) const return maDefTexts.get( nDefTextId ); } -void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, XclImpDffConverter& rDffConv, const OUString& rObjName ) const +bool XclImpChChart::IsManualPlotArea() const +{ + // there is no real automatic mode in BIFF5 charts + return (GetBiff() <= EXC_BIFF5) || ::get_flag( maProps.mnFlags, EXC_CHPROPS_USEMANPLOTAREA ); +} + +void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, + XclImpDffConverter& rDffConv, const OUString& rObjName, const Rectangle& rChartRect ) const { // initialize conversion (locks the model to suppress any internal updates) - InitConversion( xChartDoc ); + InitConversion( xChartDoc, rChartRect ); - // chart frame and title + // chart frame formatting if( mxFrame.is() ) { ScfPropertySet aFrameProp( xChartDoc->getPageBackground() ); mxFrame->Convert( aFrameProp ); } - if( mxTitle.is() ) + + // chart title + if( mxTitle.is() ) try + { + Reference< XTitled > xTitled( xChartDoc, UNO_QUERY_THROW ); + Reference< XTitle > xTitle( mxTitle->CreateTitle(), UNO_SET_THROW ); + xTitled->setTitleObject( xTitle ); + } + catch( Exception& ) { - Reference< XTitled > xTitled( xChartDoc, UNO_QUERY ); - Reference< XTitle > xTitle = mxTitle->CreateTitle(); - if( xTitled.is() && xTitle.is() ) - xTitled->setTitleObject( xTitle ); } /* Create the diagram object and attach it to the chart document. Currently, @@ -3548,13 +3731,48 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, XclImpDffCon if( xDiagram.is() && mxLegend.is() ) xDiagram->setLegend( mxLegend->CreateLegend() ); - // set the IncludeHiddenCells property via the old API as only this ensures that the data provider and al created sequences get this flag correctly - Reference< com::sun::star::chart::XChartDocument > xStandardApiChartDoc( xChartDoc, UNO_QUERY ); - if( xStandardApiChartDoc.is() ) + /* Following all conversions needing the old Chart1 API that involves full + initialization of the chart view. */ + Reference< cssc::XChartDocument > xChart1Doc( xChartDoc, UNO_QUERY ); + if( xChart1Doc.is() ) { - ScfPropertySet aDiagramProp( xStandardApiChartDoc->getDiagram() ); - bool bShowVisCells = (maProps.mnFlags & EXC_CHPROPS_SHOWVISIBLEONLY); - aDiagramProp.SetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS, !bShowVisCells ); + Reference< cssc::XDiagram > xDiagram1 = xChart1Doc->getDiagram(); + + /* Set the 'IncludeHiddenCells' property via the old API as only this + ensures that the data provider and all created sequences get this + flag correctly. */ + ScfPropertySet aDiaProp( xDiagram1 ); + bool bShowVisCells = ::get_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY ); + aDiaProp.SetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS, !bShowVisCells ); + + // plot area position and size (there is no real automatic mode in BIFF5 charts) + XclImpChFramePosRef xPlotAreaPos = mxPrimAxesSet->GetPlotAreaFramePos(); + if( IsManualPlotArea() && xPlotAreaPos.is() ) try + { + const XclChFramePos& rFramePos = xPlotAreaPos->GetFramePosData(); + if( (rFramePos.mnTLMode == EXC_CHFRAMEPOS_PARENT) && (rFramePos.mnBRMode == EXC_CHFRAMEPOS_PARENT) ) + { + Reference< cssc::XDiagramPositioning > xPositioning( xDiagram1, UNO_QUERY_THROW ); + ::com::sun::star::awt::Rectangle aDiagramRect = CalcHmmFromChartRect( rFramePos.maRect ); + // for pie charts, always set inner plot area size to exclude the data labels as Excel does + const XclImpChTypeGroup* pFirstTypeGroup = mxPrimAxesSet->GetFirstTypeGroup().get(); + if( pFirstTypeGroup && (pFirstTypeGroup->GetTypeInfo().meTypeCateg == EXC_CHTYPECATEG_PIE) ) + xPositioning->setDiagramPositionExcludingAxes( aDiagramRect ); + else if( pFirstTypeGroup && pFirstTypeGroup->Is3dChart() ) + xPositioning->setDiagramPositionIncludingAxesAndAxisTitles( aDiagramRect ); + else + xPositioning->setDiagramPositionIncludingAxes( aDiagramRect ); + } + } + catch( Exception& ) + { + } + + // positions of all title objects + if( mxTitle.is() ) + mxTitle->ConvertTitlePosition( XclChTextKey( EXC_CHTEXTTYPE_TITLE ) ); + mxPrimAxesSet->ConvertTitlePositions(); + mxSecnAxesSet->ConvertTitlePositions(); } // unlock the model @@ -3689,21 +3907,24 @@ void XclImpChChart::FinalizeDataFormats() void XclImpChChart::FinalizeTitle() { - if( (!mxTitle || (!mxTitle->IsDeleted() && !mxTitle->HasString())) && !mxSecnAxesSet->IsValidAxesSet() ) + // special handling for auto-generated title + String aAutoTitle; + if( !mxTitle || (!mxTitle->IsDeleted() && !mxTitle->HasString()) ) { - /* Chart title is auto-generated from series title, if there is only - one series with title in the chart. */ - const String& rSerTitle = mxPrimAxesSet->GetSingleSeriesTitle(); - if( rSerTitle.Len() > 0 ) + // automatic title from first series name (if there are no series on secondary axes set) + if( !mxSecnAxesSet->IsValidAxesSet() ) + aAutoTitle = mxPrimAxesSet->GetSingleSeriesTitle(); + if( mxTitle.is() || (aAutoTitle.Len() > 0) ) { if( !mxTitle ) mxTitle.reset( new XclImpChText( GetChRoot() ) ); - mxTitle->SetString( rSerTitle ); + if( aAutoTitle.Len() == 0 ) + aAutoTitle = CREATE_STRING( "Chart Title" ); } } - // will reset mxTitle, if it does not contain a string - lclFinalizeTitle( mxTitle, GetDefaultText( EXC_CHTEXTTYPE_TITLE ) ); + // will reset mxTitle, if it does not contain a string and no auto title exists + lclFinalizeTitle( mxTitle, GetDefaultText( EXC_CHTEXTTYPE_TITLE ), aAutoTitle ); } Reference< XDiagram > XclImpChChart::CreateDiagram() const @@ -3715,7 +3936,7 @@ Reference< XDiagram > XclImpChChart::CreateDiagram() const ScfPropertySet aDiaProp( xDiagram ); // treatment of missing values - using namespace ::com::sun::star::chart::MissingValueTreatment; + using namespace cssc::MissingValueTreatment; sal_Int32 nMissingValues = LEAVE_GAP; switch( maProps.mnEmptyMode ) { @@ -3775,10 +3996,10 @@ Rectangle XclImpChartDrawing::CalcAnchorRect( const XclObjAnchor& rAnchor, bool in the cell address components of the client anchor. In old BIFF3-BIFF5 objects, the position is stored in the offset components of the anchor. */ Rectangle aRect( - static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maFirst.mnCol : rAnchor.mnLX ) / EXC_CHART_UNIT * maChartRect.GetWidth() + 0.5 ), - static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maFirst.mnRow : rAnchor.mnTY ) / EXC_CHART_UNIT * maChartRect.GetHeight() + 0.5 ), - static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maLast.mnCol : rAnchor.mnRX ) / EXC_CHART_UNIT * maChartRect.GetWidth() + 0.5 ), - static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maLast.mnRow : rAnchor.mnBY ) / EXC_CHART_UNIT * maChartRect.GetHeight() + 0.5 ) ); + static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maFirst.mnCol : rAnchor.mnLX ) / EXC_CHART_TOTALUNITS * maChartRect.GetWidth() + 0.5 ), + static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maFirst.mnRow : rAnchor.mnTY ) / EXC_CHART_TOTALUNITS * maChartRect.GetHeight() + 0.5 ), + static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maLast.mnCol : rAnchor.mnRX ) / EXC_CHART_TOTALUNITS * maChartRect.GetWidth() + 0.5 ), + static_cast< long >( static_cast< double >( bDffAnchor ? rAnchor.maLast.mnRow : rAnchor.mnBY ) / EXC_CHART_TOTALUNITS * maChartRect.GetHeight() + 0.5 ) ); aRect.Justify(); // move shapes into chart area for sheet charts if( mbOwnTab ) @@ -3892,7 +4113,7 @@ void XclImpChart::Convert( Reference< XModel > xModel, XclImpDffConverter& rDffC if( xChartDoc.is() ) { if( mxChartData.is() ) - mxChartData->Convert( xChartDoc, rDffConv, rObjName ); + mxChartData->Convert( xChartDoc, rDffConv, rObjName, rChartRect ); if( mxChartDrawing.is() ) mxChartDrawing->ConvertObjects( rDffConv, xModel, rChartRect ); } diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 45eed0fd98a9..dc2234570ea6 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -575,6 +575,7 @@ void XclImpSupbook::LoadCachedValues() const String& rTabName = pTab->GetTabName(); ScExternalRefCache::TableTypeRef pCacheTable = pRefMgr->getCacheTable(nFileId, rTabName, true); pTab->LoadCachedValues(pCacheTable); + pCacheTable->setWholeTableCached(); } } diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 41e682f85808..10a0657c7899 100644..100755 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -38,11 +38,13 @@ #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/BitmapMode.hpp> -#include <com/sun/star/chart2/RelativePosition.hpp> -#include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> -#include <com/sun/star/chart2/Symbol.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> +#include <com/sun/star/chart/XAxisXSupplier.hpp> +#include <com/sun/star/chart/XAxisYSupplier.hpp> +#include <com/sun/star/chart/XAxisZSupplier.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> +#include <com/sun/star/chart2/Symbol.hpp> #include <rtl/math.hxx> #include <svl/itemset.hxx> @@ -55,9 +57,8 @@ #include <filter/msfilter/escherex.hxx> #include <editeng/memberids.hrc> #include "global.hxx" -#include "xlconst.hxx" +#include "xlroot.hxx" #include "xlstyle.hxx" -#include "xltools.hxx" using ::rtl::OUString; using ::com::sun::star::uno::Any; @@ -66,6 +67,9 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::chart2::XChartDocument; +using ::com::sun::star::drawing::XShape; + +namespace cssc = ::com::sun::star::chart; // Common ===================================================================== @@ -104,8 +108,8 @@ XclChFrBlock::XclChFrBlock( sal_uInt16 nType ) : // Frame formatting =========================================================== XclChFramePos::XclChFramePos() : - mnObjType( EXC_CHFRAMEPOS_ANY ), - mnSizeMode( EXC_CHFRAMEPOS_AUTOSIZE ) + mnTLMode( EXC_CHFRAMEPOS_PARENT ), + mnBRMode( EXC_CHFRAMEPOS_PARENT ) { } @@ -189,7 +193,7 @@ XclChText::XclChText() : mnVAlign( EXC_CHTEXT_ALIGN_CENTER ), mnBackMode( EXC_CHTEXT_TRANSPARENT ), mnFlags( EXC_CHTEXT_AUTOCOLOR | EXC_CHTEXT_AUTOFILL ), - mnPlacement( EXC_CHTEXT_POS_DEFAULT ), + mnFlags2( EXC_CHTEXT_POS_DEFAULT ), mnRotation( EXC_ROT_NONE ) { } @@ -512,7 +516,7 @@ const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartTyp const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType"; const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo -namespace csscd = ::com::sun::star::chart::DataLabelPlacement; +namespace csscd = cssc::DataLabelPlacement; static const XclChTypeInfo spTypeInfos[] = { @@ -680,10 +684,6 @@ const sal_Char* const sppcHatchNamesFilled[] = { "FillStyle", "HatchName", "Colo /** Property names for bitmap area style. */ const sal_Char* const sppcBitmapNames[] = { "FillStyle", "FillBitmapName", "FillBitmapMode", 0 }; -/** Property names for legend properties. */ -const sal_Char* const sppcLegendNames[] = - { "Show", "AnchorPosition", "Expansion", "RelativePosition", 0 }; - } // namespace // ---------------------------------------------------------------------------- @@ -698,8 +698,7 @@ XclChPropSetHelper::XclChPropSetHelper() : maGradHlpFilled( sppcGradNamesFilled ), maHatchHlpCommon( sppcHatchNamesCommon ), maHatchHlpFilled( sppcHatchNamesFilled ), - maBitmapHlp( sppcBitmapNames ), - maLegendHlp( sppcLegendNames ) + maBitmapHlp( sppcBitmapNames ) { } @@ -957,46 +956,6 @@ sal_uInt16 XclChPropSetHelper::ReadRotationProperties( const ScfPropertySet& rPr XclTools::GetXclRotation( static_cast< sal_Int32 >( fAngle * 100.0 + 0.5 ) ); } -void XclChPropSetHelper::ReadLegendProperties( XclChLegend& rLegend, const ScfPropertySet& rPropSet ) -{ - namespace cssc = ::com::sun::star::chart2; - namespace cssd = ::com::sun::star::drawing; - - // read the properties - bool bShow; - cssc::LegendPosition eApiPos; - cssc::LegendExpansion eApiExpand; - Any aRelPosAny; - maLegendHlp.ReadFromPropertySet( rPropSet ); - maLegendHlp >> bShow >> eApiPos >> eApiExpand >> aRelPosAny; - DBG_ASSERT( bShow, "XclChPropSetHelper::ReadLegendProperties - legend must be visible" ); - - // legend position - switch( eApiPos ) - { - case cssc::LegendPosition_LINE_START: rLegend.mnDockMode = EXC_CHLEGEND_LEFT; break; - case cssc::LegendPosition_LINE_END: rLegend.mnDockMode = EXC_CHLEGEND_RIGHT; break; - case cssc::LegendPosition_PAGE_START: rLegend.mnDockMode = EXC_CHLEGEND_TOP; break; - case cssc::LegendPosition_PAGE_END: rLegend.mnDockMode = EXC_CHLEGEND_BOTTOM; break; - default: rLegend.mnDockMode = EXC_CHLEGEND_NOTDOCKED; - } - // legend expansion - ::set_flag( rLegend.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand != cssc::LegendExpansion_WIDE ); - // legend position - if( rLegend.mnDockMode == EXC_CHLEGEND_NOTDOCKED ) - { - cssc::RelativePosition aRelPos; - if( aRelPosAny >>= aRelPos ) - { - rLegend.maRect.mnX = limit_cast< sal_Int32 >( aRelPos.Primary * EXC_CHART_UNIT, 0, EXC_CHART_UNIT ); - rLegend.maRect.mnY = limit_cast< sal_Int32 >( aRelPos.Secondary * EXC_CHART_UNIT, 0, EXC_CHART_UNIT ); - } - else - rLegend.mnDockMode = EXC_CHLEGEND_LEFT; - } - ::set_flag( rLegend.mnFlags, EXC_CHLEGEND_DOCKED, rLegend.mnDockMode != EXC_CHLEGEND_NOTDOCKED ); -} - // write properties ----------------------------------------------------------- void XclChPropSetHelper::WriteLineProperties( @@ -1207,51 +1166,6 @@ void XclChPropSetHelper::WriteRotationProperties( } } -void XclChPropSetHelper::WriteLegendProperties( - ScfPropertySet& rPropSet, const XclChLegend& rLegend ) -{ - namespace cssc = ::com::sun::star::chart2; - namespace cssd = ::com::sun::star::drawing; - - // legend position - cssc::LegendPosition eApiPos = cssc::LegendPosition_CUSTOM; - switch( rLegend.mnDockMode ) - { - case EXC_CHLEGEND_LEFT: eApiPos = cssc::LegendPosition_LINE_START; break; - case EXC_CHLEGEND_RIGHT: eApiPos = cssc::LegendPosition_LINE_END; break; - case EXC_CHLEGEND_TOP: eApiPos = cssc::LegendPosition_PAGE_START; break; - case EXC_CHLEGEND_BOTTOM: eApiPos = cssc::LegendPosition_PAGE_END; break; - } - // legend expansion - cssc::LegendExpansion eApiExpand = ::get_flagvalue( - rLegend.mnFlags, EXC_CHLEGEND_STACKED, cssc::LegendExpansion_HIGH, cssc::LegendExpansion_WIDE ); - // legend position - Any aRelPosAny; - if( eApiPos == cssc::LegendPosition_CUSTOM ) - { - // #i71697# it is not possible to set the size directly, do some magic here - double fRatio = ((rLegend.maRect.mnWidth > 0) && (rLegend.maRect.mnHeight > 0)) ? - (static_cast< double >( rLegend.maRect.mnWidth ) / rLegend.maRect.mnHeight) : 1.0; - if( fRatio > 1.5 ) - eApiExpand = cssc::LegendExpansion_WIDE; - else if( fRatio < 0.75 ) - eApiExpand = cssc::LegendExpansion_HIGH; - else - eApiExpand = cssc::LegendExpansion_BALANCED; - // set position - cssc::RelativePosition aRelPos; - aRelPos.Primary = static_cast< double >( rLegend.maRect.mnX ) / EXC_CHART_UNIT; - aRelPos.Secondary = static_cast< double >( rLegend.maRect.mnY ) / EXC_CHART_UNIT; - aRelPos.Anchor = cssd::Alignment_TOP_LEFT; - aRelPosAny <<= aRelPos; - } - - // write the properties - maLegendHlp.InitializeWrite(); - maLegendHlp << true << eApiPos << eApiExpand << aRelPosAny; - maLegendHlp.WriteToPropertySet( rPropSet ); -} - // private -------------------------------------------------------------------- ScfPropSetHelper& XclChPropSetHelper::GetLineHelper( XclChPropertyMode ePropMode ) @@ -1301,27 +1215,81 @@ ScfPropSetHelper& XclChPropSetHelper::GetHatchHelper( XclChPropertyMode ePropMod // ============================================================================ +namespace { + +/* The following local functions implement getting the XShape interface of all + supported title objects (chart and axes). This needs some effort due to the + design of the old Chart1 API used to access these objects. */ + +/** A code fragment that returns a shape object from the passed shape supplier + using the specified interface function. Checks a boolean property first. */ +#define EXC_FRAGMENT_GETTITLESHAPE( shape_supplier, supplier_func, property_name ) \ + ScfPropertySet aPropSet( shape_supplier ); \ + if( shape_supplier.is() && aPropSet.GetBoolProperty( CREATE_OUSTRING( #property_name ) ) ) \ + return shape_supplier->supplier_func(); \ + return Reference< XShape >(); \ + +/** Implements a function returning the drawing shape of an axis title, if + existing, using the specified API interface and its function. */ +#define EXC_DEFINEFUNC_GETAXISTITLESHAPE( func_name, interface_type, supplier_func, property_name ) \ +Reference< XShape > func_name( const Reference< cssc::XChartDocument >& rxChart1Doc ) \ +{ \ + Reference< cssc::interface_type > xAxisSupp( rxChart1Doc->getDiagram(), UNO_QUERY ); \ + EXC_FRAGMENT_GETTITLESHAPE( xAxisSupp, supplier_func, property_name ) \ +} + +/** Returns the drawing shape of the main title, if existing. */ +Reference< XShape > lclGetMainTitleShape( const Reference< cssc::XChartDocument >& rxChart1Doc ) +{ + EXC_FRAGMENT_GETTITLESHAPE( rxChart1Doc, getTitle, HasMainTitle ) +} + +EXC_DEFINEFUNC_GETAXISTITLESHAPE( lclGetXAxisTitleShape, XAxisXSupplier, getXAxisTitle, HasXAxisTitle ) +EXC_DEFINEFUNC_GETAXISTITLESHAPE( lclGetYAxisTitleShape, XAxisYSupplier, getYAxisTitle, HasYAxisTitle ) +EXC_DEFINEFUNC_GETAXISTITLESHAPE( lclGetZAxisTitleShape, XAxisZSupplier, getZAxisTitle, HasZAxisTitle ) +EXC_DEFINEFUNC_GETAXISTITLESHAPE( lclGetSecXAxisTitleShape, XSecondAxisTitleSupplier, getSecondXAxisTitle, HasSecondaryXAxisTitle ) +EXC_DEFINEFUNC_GETAXISTITLESHAPE( lclGetSecYAxisTitleShape, XSecondAxisTitleSupplier, getSecondYAxisTitle, HasSecondaryYAxisTitle ) + +#undef EXC_DEFINEFUNC_GETAXISTITLESHAPE +#undef EXC_IMPLEMENT_GETTITLESHAPE + +} // namespace + +// ---------------------------------------------------------------------------- + XclChRootData::XclChRootData() : mxTypeInfoProv( new XclChTypeInfoProvider ), - mxFmtInfoProv( new XclChFormatInfoProvider ) + mxFmtInfoProv( new XclChFormatInfoProvider ), + mnBorderGapX( 0 ), + mnBorderGapY( 0 ) { + // remember some title shape getter functions + maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_TITLE ) ] = lclGetMainTitleShape; + maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, EXC_CHAXESSET_PRIMARY, EXC_CHAXIS_X ) ] = lclGetXAxisTitleShape; + maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, EXC_CHAXESSET_PRIMARY, EXC_CHAXIS_Y ) ] = lclGetYAxisTitleShape; + maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, EXC_CHAXESSET_PRIMARY, EXC_CHAXIS_Z ) ] = lclGetZAxisTitleShape; + maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, EXC_CHAXESSET_SECONDARY, EXC_CHAXIS_X ) ] = lclGetSecXAxisTitleShape; + maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_AXISTITLE, EXC_CHAXESSET_SECONDARY, EXC_CHAXIS_Y ) ] = lclGetSecYAxisTitleShape; } XclChRootData::~XclChRootData() { } -Reference< XChartDocument > XclChRootData::GetChartDoc() const +void XclChRootData::InitConversion( const XclRoot& rRoot, const Reference< XChartDocument >& rxChartDoc, const Rectangle& rChartRect ) { - DBG_ASSERT( mxChartDoc.is(), "XclChRootData::GetChartDoc - missing chart document" ); - return mxChartDoc; -} + // remember chart document reference and chart shape position/size + DBG_ASSERT( rxChartDoc.is(), "XclChRootData::InitConversion - missing chart document" ); + mxChartDoc = rxChartDoc; + maChartRect = rChartRect; -void XclChRootData::InitConversion( XChartDocRef xChartDoc ) -{ - // remember chart document reference - DBG_ASSERT( xChartDoc.is(), "XclChRootData::InitConversion - missing chart document" ); - mxChartDoc = xChartDoc; + // Excel excludes a border of 5 pixels in each direction from chart area + mnBorderGapX = rRoot.GetHmmFromPixelX( 5.0 ); + mnBorderGapY = rRoot.GetHmmFromPixelY( 5.0 ); + + // size of a chart unit in 1/100 mm + mfUnitSizeX = ::std::max< double >( maChartRect.GetWidth() - 2 * mnBorderGapX, mnBorderGapX ) / EXC_CHART_TOTALUNITS; + mfUnitSizeY = ::std::max< double >( maChartRect.GetHeight() - 2 * mnBorderGapY, mnBorderGapY ) / EXC_CHART_TOTALUNITS; // create object tables Reference< XMultiServiceFactory > xFactory( mxChartDoc, UNO_QUERY ); @@ -1346,5 +1314,15 @@ void XclChRootData::FinishConversion() mxChartDoc.clear(); } -// ============================================================================ +Reference< XShape > XclChRootData::GetTitleShape( const XclChTextKey& rTitleKey ) const +{ + XclChGetShapeFuncMap::const_iterator aIt = maGetShapeFuncs.find( rTitleKey ); + OSL_ENSURE( aIt != maGetShapeFuncs.end(), "XclChRootData::GetTitleShape - invalid title key" ); + Reference< cssc::XChartDocument > xChart1Doc( mxChartDoc, UNO_QUERY ); + Reference< XShape > xTitleShape; + if( xChart1Doc.is() && (aIt != maGetShapeFuncs.end()) ) + xTitleShape = (aIt->second)( xChart1Doc ); + return xTitleShape; +} +// ============================================================================ diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 8a22b05828b9..2b2180db5e6a 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -28,7 +28,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" #include "xlroot.hxx" +#include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/i18n/ScriptType.hpp> +#include <comphelper/processfactory.hxx> #include <vcl/svapp.hxx> #include <svl/stritem.hxx> #include <svl/languageoptions.hxx> @@ -57,6 +61,15 @@ namespace ApiScriptType = ::com::sun::star::i18n::ScriptType; using ::rtl::OUString; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::awt::XDevice; +using ::com::sun::star::awt::DeviceInfo; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XFramesSupplier; +using ::com::sun::star::lang::XMultiServiceFactory; // Global data ================================================================ @@ -88,6 +101,8 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium, mxFontPropSetHlp( new XclFontPropSetHelper ), mxChPropSetHlp( new XclChPropSetHelper ), mxRD( new RootData ),//! + mfScreenPixelX( 50.0 ), + mfScreenPixelY( 50.0 ), mnCharWidth( 110 ), mnScTab( 0 ), mbExport( bExport ) @@ -129,6 +144,22 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium, mxExtDocOpt.reset( new ScExtDocOptions( *pOldDocOpt ) ); else mxExtDocOpt.reset( new ScExtDocOptions ); + + // screen pixel size + try + { + Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW ); + Reference< XFramesSupplier > xFramesSupp( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW ); + Reference< XFrame > xFrame( xFramesSupp->getActiveFrame(), UNO_SET_THROW ); + Reference< XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW ); + DeviceInfo aDeviceInfo = xDevice->getInfo(); + mfScreenPixelX = (aDeviceInfo.PixelPerMeterX > 0) ? (100000.0 / aDeviceInfo.PixelPerMeterX) : 50.0; + mfScreenPixelY = (aDeviceInfo.PixelPerMeterY > 0) ? (100000.0 / aDeviceInfo.PixelPerMeterY) : 50.0; + } + catch( Exception& ) + { + OSL_ENSURE( false, "XclRootData::XclRootData - cannot get output device info" ); + } } XclRootData::~XclRootData() @@ -199,6 +230,16 @@ void XclRoot::SetCharWidth( const XclFontData& rFontData ) } } +sal_Int32 XclRoot::GetHmmFromPixelX( double fPixelX ) const +{ + return static_cast< sal_Int32 >( fPixelX * mrData.mfScreenPixelX + 0.5 ); +} + +sal_Int32 XclRoot::GetHmmFromPixelY( double fPixelY ) const +{ + return static_cast< sal_Int32 >( fPixelY * mrData.mfScreenPixelY + 0.5 ); +} + String XclRoot::RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const { ::std::vector< OUString > aDefaultPasswords; diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx index 2cf976b11efe..5bb75e029210 100644 --- a/sc/source/filter/inc/xechart.hxx +++ b/sc/source/filter/inc/xechart.hxx @@ -39,6 +39,10 @@ class Size; namespace com { namespace sun { namespace star { + namespace awt + { + struct Rectangle; + } namespace frame { class XModel; @@ -65,7 +69,7 @@ namespace com { namespace sun { namespace star { // Common ===================================================================== -class XclExpChRootData; +struct XclExpChRootData; class XclExpChChart; /** Base class for complex chart classes, provides access to other components @@ -80,11 +84,13 @@ public: typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef; public: - explicit XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart* pChartData ); + explicit XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart& rChartData ); virtual ~XclExpChRoot(); /** Returns this root instance - for code readability in derived classes. */ inline const XclExpChRoot& GetChRoot() const { return *this; } + /** Returns the API Chart document model. */ + XChartDocRef GetChartDocument() const; /** Returns a reference to the parent chart data object. */ XclExpChChart& GetChartData() const; /** Returns chart type info for a unique chart type identifier. */ @@ -96,7 +102,7 @@ public: const XclChFormatInfo& GetFormatInfo( XclChObjectType eObjType ) const; /** Starts the API chart document conversion. Must be called once before all API conversion. */ - void InitConversion( XChartDocRef xChartDoc ) const; + void InitConversion( XChartDocRef xChartDoc, const Rectangle& rChartRect ) const; /** Finishes the API chart document conversion. Must be called once after all API conversion. */ void FinishConversion() const; @@ -105,6 +111,18 @@ public: /** Sets a system color and the respective color identifier. */ void SetSystemColor( Color& rColor, sal_uInt32& rnColorId, sal_uInt16 nSysColorIdx ) const; + /** Converts the passed horizontal coordinate from 1/100 mm to Excel chart units. */ + sal_Int32 CalcChartXFromHmm( sal_Int32 nPosX ) const; + /** Converts the passed vertical coordinate from 1/100 mm to Excel chart units. */ + sal_Int32 CalcChartYFromHmm( sal_Int32 nPosY ) const; + /** Converts the passed rectangle from 1/100 mm to Excel chart units. */ + XclChRectangle CalcChartRectFromHmm( const ::com::sun::star::awt::Rectangle& rRect ) const; + + /** Converts the passed horizontal coordinate from a relative position to Excel chart units. */ + sal_Int32 CalcChartXFromRelative( double fPosX ) const; + /** Converts the passed vertical coordinate from a relative position to Excel chart units. */ + sal_Int32 CalcChartYFromRelative( double fPosY ) const; + /** Reads all line properties from the passed property set. */ void ConvertLineFormat( XclChLineFormat& rLineFmt, @@ -191,6 +209,25 @@ public: // Frame formatting =========================================================== +class XclExpChFramePos : public XclExpRecord +{ +public: + explicit XclExpChFramePos( sal_uInt16 nTLMode, sal_uInt16 nBRMode ); + + /** Returns read/write access to the frame position data. */ + inline XclChFramePos& GetFramePosData() { return maData; } + +private: + virtual void WriteBody( XclExpStream& rStrm ); + +private: + XclChFramePos maData; /// Position of the frame. +}; + +typedef ScfRef< XclExpChFramePos > XclExpChFramePosRef; + +// ---------------------------------------------------------------------------- + class XclExpChLineFormat : public XclExpRecord { public: @@ -514,6 +551,7 @@ private: private: XclChText maData; /// Contents of the CHTEXT record. + XclExpChFramePosRef mxFramePos; /// Relative text frame position (CHFRAMEPOS record). XclExpChSourceLinkRef mxSrcLink; /// Linked data (CHSOURCELINK with CHSTRING record). XclExpChFrameRef mxFrame; /// Text object frame properties (CHFRAME group). XclExpChFontRef mxFont; /// Index into font buffer (CHFONT record). @@ -830,8 +868,8 @@ typedef ScfRef< XclExpChChart3d > XclExpChChart3dRef; /** Represents the CHLEGEND record group describing the chart legend. - The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAME group, - CHTEXT group, CHEND. + The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME + group, CHTEXT group, CHEND. */ class XclExpChLegend : public XclExpChGroupBase { @@ -849,6 +887,7 @@ private: private: XclChLegend maData; /// Contents of the CHLEGEND record. + XclExpChFramePosRef mxFramePos; /// Legend frame position (CHFRAMEPOS record). XclExpChTextRef mxText; /// Legend text format (CHTEXT group). XclExpChFrameRef mxFrame; /// Legend frame format (CHFRAME group). }; @@ -1137,6 +1176,7 @@ private: typedef XclExpRecordList< XclExpChTypeGroup > XclExpChTypeGroupList; XclChAxesSet maData; /// Contents of the CHAXESSET record. + XclExpChFramePosRef mxFramePos; /// Outer plot area position (CHFRAMEPOS record). XclExpChAxisRef mxXAxis; /// The X axis (CHAXIS group). XclExpChAxisRef mxYAxis; /// The Y axis (CHAXIS group). XclExpChAxisRef mxZAxis; /// The Z axis (CHAXIS group). @@ -1164,7 +1204,7 @@ public: public: explicit XclExpChChart( const XclExpRoot& rRoot, - XChartDocRef xChartDoc, const Size& rSize ); + XChartDocRef xChartDoc, const Rectangle& rChartRect ); /** Creates, registers and returns a new data series object. */ XclExpChSeriesRef CreateSeries(); @@ -1172,6 +1212,8 @@ public: void RemoveLastSeries(); /** Stores a CHTEXT group that describes a data point label. */ void SetDataLabel( XclExpChTextRef xText ); + /** Sets the plot area position and size to manual mode. */ + void SetManualPlotArea(); /** Writes all embedded records. */ virtual void WriteSubRecords( XclExpStream& rStrm ); @@ -1224,7 +1266,7 @@ public: public: explicit XclExpChart( const XclExpRoot& rRoot, - XModelRef xModel, const Size& rSize ); + XModelRef xModel, const Rectangle& rChartRect ); }; // ============================================================================ diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index 5d03c99b124a..d8289b3b671b 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -43,10 +43,18 @@ #include "xistring.hxx" namespace com { namespace sun { namespace star { + namespace awt + { + struct Rectangle; + } namespace frame { class XModel; } + namespace drawing + { + class XShape; + } namespace chart2 { struct ScaleData; @@ -75,7 +83,7 @@ struct XclObjFillData; // Common ===================================================================== class ScfProgressBar; -class XclImpChRootData; +struct XclImpChRootData; class XclImpChChart; class ScTokenArray; @@ -83,11 +91,10 @@ class ScTokenArray; class XclImpChRoot : public XclImpRoot { public: - typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef; - typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > XDataProviderRef; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef; public: - explicit XclImpChRoot( const XclImpRoot& rRoot, XclImpChChart* pChartData ); + explicit XclImpChRoot( const XclImpRoot& rRoot, XclImpChChart& rChartData ); virtual ~XclImpChRoot(); /** Returns this root instance - for code readability in derived classes. */ @@ -109,12 +116,28 @@ public: Color GetSeriesFillAutoColor( sal_uInt16 nFormatIdx ) const; /** Starts the API chart document conversion. Must be called once before all API conversion. */ - void InitConversion( XChartDocRef xChartDoc ) const; + void InitConversion( XChartDocRef xChartDoc, const Rectangle& rChartRect ) const; /** Finishes the API chart document conversion. Must be called once after all API conversion. */ void FinishConversion( XclImpDffConverter& rDffConv ) const; /** Returns the data provider for the chart document. */ - XDataProviderRef GetDataProvider() const; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > + GetDataProvider() const; + /** Returns the drawing shape interface of the specified title object. */ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + GetTitleShape( const XclChTextKey& rTitleKey ) const; + + /** Converts the passed horizontal coordinate from Excel chart units into 1/100 mm. */ + sal_Int32 CalcHmmFromChartX( sal_Int32 nPosX ) const; + /** Converts the passed vertical coordinate from Excel chart units into 1/100 mm. */ + sal_Int32 CalcHmmFromChartY( sal_Int32 nPosY ) const; + /** Converts the passed rectangle from Excel chart units into 1/100 mm. */ + ::com::sun::star::awt::Rectangle CalcHmmFromChartRect( const XclChRectangle& rRect ) const; + + /** Converts the passed horizontal coordinate from Excel chart units into a relative position. */ + double CalcRelativeFromChartX( sal_Int32 nPosX ) const; + /** Converts the passed vertical coordinate from Excel chart units into a relative position. */ + double CalcRelativeFromChartY( sal_Int32 nPosY ) const; /** Writes all line properties to the passed property set. */ void ConvertLineFormat( @@ -184,6 +207,9 @@ public: /** Reads the CHFRAMEPOS record (frame position and size). */ void ReadChFramePos( XclImpStream& rStrm ); + /** Returns read-only access to the imported frame position data. */ + inline const XclChFramePos& GetFramePosData() const { return maData; } + private: XclChFramePos maData; /// Position of the frame. }; @@ -506,6 +532,8 @@ public: void ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo ) const; /** Creates a title text object. */ XTitleRef CreateTitle() const; + /** Converts the manual position of the specified title */ + void ConvertTitlePosition( const XclChTextKey& rTitleKey ) const; private: using XclImpChRoot::ConvertFont; @@ -519,6 +547,7 @@ private: XclChText maData; /// Contents of the CHTEXT record. XclChObjectLink maObjLink; /// Link target for this text object. XclFormatRunVec maFormats; /// Formatting runs (CHFORMATRUNS record). + XclImpChFramePosRef mxFramePos; /// Relative text frame position (CHFRAMEPOS record). XclImpChSourceLinkRef mxSrcLink; /// Linked data (CHSOURCELINK with CHSTRING record). XclImpChFrameRef mxFrame; /// Text object frame properties (CHFRAME group). XclImpChFontRef mxFont; /// Index into font buffer (CHFONT record). @@ -922,8 +951,8 @@ typedef ScfRef< XclImpChChart3d > XclImpChChart3dRef; /** Represents the CHLEGEND record group describing the chart legend. - The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAME group, - CHTEXT group, CHEND. + The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME + group, CHTEXT group, CHEND. */ class XclImpChLegend : public XclImpChGroupBase, protected XclImpChRoot { @@ -945,6 +974,7 @@ public: private: XclChLegend maData; /// Contents of the CHLEGEND record. + XclImpChFramePosRef mxFramePos; /// Legend frame position (CHFRAMEPOS record). XclImpChTextRef mxText; /// Legend text format (CHTEXT group). XclImpChFrameRef mxFrame; /// Legend frame format (CHFRAME group). }; @@ -1265,6 +1295,8 @@ public: /** Returns the axes set index used by the chart API. */ inline sal_Int32 GetApiAxesSetIndex() const { return maData.GetApiAxesSetIndex(); } + /** Returns the outer plot area position, if existing. */ + inline XclImpChFramePosRef GetPlotAreaFramePos() const { return mxFramePos; } /** Returns the specified chart type group. */ inline XclImpChTypeGroupRef GetTypeGroup( sal_uInt16 nGroupIdx ) const { return maTypeGroups.get( nGroupIdx ); } /** Returns the first chart type group. */ @@ -1276,6 +1308,8 @@ public: /** Creates a coordinate system and converts all series and axis settings. */ void Convert( XDiagramRef xDiagram ) const; + /** Converts the manual positions of all axis titles. */ + void ConvertTitlePositions() const; private: /** Reads a CHAXIS record group containing a single axis. */ @@ -1304,7 +1338,7 @@ private: typedef ScfRefMap< sal_uInt16, XclImpChTypeGroup > XclImpChTypeGroupMap; XclChAxesSet maData; /// Contents of the CHAXESSET record. - XclImpChFramePosRef mxPos; /// Position of the axes set (CHFRAMEPOS record). + XclImpChFramePosRef mxFramePos; /// Outer plot area position (CHFRAMEPOS record). XclImpChAxisRef mxXAxis; /// The X axis (CHAXIS group). XclImpChAxisRef mxYAxis; /// The Y axis (CHAXIS group). XclImpChAxisRef mxZAxis; /// The Z axis (CHAXIS group). @@ -1351,13 +1385,16 @@ public: XclImpChTypeGroupRef GetTypeGroup( sal_uInt16 nGroupIdx ) const; /** Returns the specified default text. */ XclImpChTextRef GetDefaultText( XclChTextType eTextType ) const; + /** Returns true, if the plot area has benn moved and/or resized manually. */ + bool IsManualPlotArea() const; /** Returns the number of units on the progress bar needed for the chart. */ inline sal_Size GetProgressSize() const { return 2 * EXC_CHART_PROGRESS_SIZE; } /** Converts and writes all properties to the passed chart. */ void Convert( XChartDocRef xChartDoc, XclImpDffConverter& rDffConv, - const ::rtl::OUString& rObjName ) const; + const ::rtl::OUString& rObjName, + const Rectangle& rChartRect ) const; private: /** Reads a CHSERIES group (data series source and formatting). */ diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index f6711211bc13..13eda8619cc0 100644..100755 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -34,14 +34,19 @@ #define EXC_CHART2_3DBAR_HAIRLINES_ONLY 1 #include <map> +#include <tools/gen.hxx> #include "fapihelper.hxx" namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } namespace lang { class XMultiServiceFactory; } + namespace chart { class XChartDocument; } namespace chart2 { class XChartDocument; } + namespace drawing { class XShape; } } } } +class XclRoot; + // Property names ============================================================= // service names @@ -72,6 +77,7 @@ namespace com { namespace sun { namespace star { // property names #define EXC_CHPROP_ADDITIONALSHAPES CREATE_OUSTRING( "AdditionalShapes" ) +#define EXC_CHPROP_ANCHORPOSITION CREATE_OUSTRING( "AnchorPosition" ) #define EXC_CHPROP_ARRANGEORDER CREATE_OUSTRING( "ArrangeOrder" ) #define EXC_CHPROP_ATTAXISINDEX CREATE_OUSTRING( "AttachedAxisIndex" ) #define EXC_CHPROP_ATTRIBDATAPOINTS CREATE_OUSTRING( "AttributedDataPoints" ) @@ -94,10 +100,12 @@ namespace com { namespace sun { namespace star { #define EXC_CHPROP_ERRORBARSTYLE CREATE_OUSTRING( "ErrorBarStyle" ) #define EXC_CHPROP_ERRORBARX CREATE_OUSTRING( "ErrorBarX" ) #define EXC_CHPROP_ERRORBARY CREATE_OUSTRING( "ErrorBarY" ) +#define EXC_CHPROP_EXPANSION CREATE_OUSTRING( "Expansion" ) #define EXC_CHPROP_FILLBITMAPMODE CREATE_OUSTRING( "FillBitmapMode" ) #define EXC_CHPROP_FILLSTYLE CREATE_OUSTRING( "FillStyle" ) #define EXC_CHPROP_GAPWIDTHSEQ CREATE_OUSTRING( "GapwidthSequence" ) #define EXC_CHPROP_GEOMETRY3D CREATE_OUSTRING( "Geometry3D" ) +#define EXC_CHPROP_HASMAINTITLE CREATE_OUSTRING( "HasMainTitle" ) #define EXC_CHPROP_INCLUDEHIDDENCELLS CREATE_OUSTRING( "IncludeHiddenCells" ) #define EXC_CHPROP_JAPANESE CREATE_OUSTRING( "Japanese" ) #define EXC_CHPROP_LABEL CREATE_OUSTRING( "Label" ) @@ -116,6 +124,7 @@ namespace com { namespace sun { namespace star { #define EXC_CHPROP_PERCENTDIAGONAL CREATE_OUSTRING( "PercentDiagonal" ) #define EXC_CHPROP_PERSPECTIVE CREATE_OUSTRING( "Perspective" ) #define EXC_CHPROP_POSITIVEERROR CREATE_OUSTRING( "PositiveError" ) +#define EXC_CHPROP_RELATIVEPOSITION CREATE_OUSTRING( "RelativePosition" ) #define EXC_CHPROP_RIGHTANGLEDAXES CREATE_OUSTRING( "RightAngledAxes" ) #define EXC_CHPROP_ROLE CREATE_OUSTRING( "Role" ) #define EXC_CHPROP_ROTATIONHORIZONTAL CREATE_OUSTRING( "RotationHorizontal" ) @@ -169,7 +178,8 @@ const sal_Int32 EXC_CHART_AXESSET_NONE = -1; /// For internal use const sal_Int32 EXC_CHART_AXESSET_PRIMARY = 0; /// API primary axes set index. const sal_Int32 EXC_CHART_AXESSET_SECONDARY = 1; /// API secondary axes set index. -const sal_Int32 EXC_CHART_UNIT = 4000; /// Chart objects are positioned in 1/4000 of chart area. +const sal_Int32 EXC_CHART_TOTALUNITS = 4000; /// Most chart objects are positioned in 1/4000 of chart area. +const sal_Int32 EXC_CHART_PLOTAREAUNITS = 1000; /// For objects that are positioned in 1/1000 of plot area. // (0x0850) CHFRINFO ---------------------------------------------------------- @@ -604,7 +614,8 @@ const sal_uInt16 EXC_ID_CHPROPERTIES = 0x1044; const sal_uInt16 EXC_CHPROPS_MANSERIES = 0x0001; /// Manual series allocation. const sal_uInt16 EXC_CHPROPS_SHOWVISIBLEONLY = 0x0002; /// Show visible cells only. const sal_uInt16 EXC_CHPROPS_NORESIZE = 0x0004; /// Do not resize chart with window. -const sal_uInt16 EXC_CHPROPS_MANPLOTAREA = 0x0008; /// Plot area with CHFRAMEPOS records. +const sal_uInt16 EXC_CHPROPS_MANPLOTAREA = 0x0008; /// Manual plot area mode. +const sal_uInt16 EXC_CHPROPS_USEMANPLOTAREA = 0x0010; /// Manual plot area layout in CHFRAMEPOS record. const sal_uInt8 EXC_CHPROPS_EMPTY_SKIP = 0; /// Skip empty values. const sal_uInt8 EXC_CHPROPS_EMPTY_ZERO = 1; /// Plot empty values as zero. @@ -643,11 +654,11 @@ const sal_uInt16 EXC_ID_CHFORMAT = 0x104E; const sal_uInt16 EXC_ID_CHFRAMEPOS = 0x104F; -const sal_uInt16 EXC_CHFRAMEPOS_ANY = 2; -const sal_uInt16 EXC_CHFRAMEPOS_LEGEND = 5; - -const sal_uInt16 EXC_CHFRAMEPOS_MANUALSIZE = 1; -const sal_uInt16 EXC_CHFRAMEPOS_AUTOSIZE = 2; +const sal_uInt16 EXC_CHFRAMEPOS_POINTS = 0; +const sal_uInt16 EXC_CHFRAMEPOS_ABSSIZE_POINTS = 1; +const sal_uInt16 EXC_CHFRAMEPOS_PARENT = 2; +const sal_uInt16 EXC_CHFRAMEPOS_DEFOFFSET_PLOT = 3; +const sal_uInt16 EXC_CHFRAMEPOS_CHARTSIZE = 5; // (0x1050) CHFORMATRUNS ------------------------------------------------------ @@ -774,8 +785,8 @@ struct XclChFrBlock struct XclChFramePos { XclChRectangle maRect; /// Object dependent position data. - sal_uInt16 mnObjType; /// Object type. - sal_uInt16 mnSizeMode; /// Size mode (manual, automatic). + sal_uInt16 mnTLMode; /// Top-left position mode. + sal_uInt16 mnBRMode; /// Bottom-right position mode. explicit XclChFramePos(); }; @@ -885,7 +896,7 @@ struct XclChText sal_uInt8 mnVAlign; /// Vertical alignment. sal_uInt16 mnBackMode; /// Background mode: transparent, opaque. sal_uInt16 mnFlags; /// Additional flags. - sal_uInt16 mnPlacement; /// Text object placement (BIFF8+). + sal_uInt16 mnFlags2; /// Text object placement and text direction (BIFF8+). sal_uInt16 mnRotation; /// Text object rotation (BIFF8+). explicit XclChText(); @@ -1013,7 +1024,6 @@ struct XclChLegend struct XclChTypeGroup { - XclChRectangle maRect; /// Position (not used). sal_uInt16 mnFlags; /// Additional flags. sal_uInt16 mnGroupIdx; /// Chart type group index. @@ -1060,7 +1070,6 @@ struct XclChValueRange struct XclChTick { - XclChRectangle maRect; /// Position (not used). Color maTextColor; /// Tick labels color. sal_uInt8 mnMajor; /// Type of tick marks of major grid. sal_uInt8 mnMinor; /// Type of tick marks of minor grid. @@ -1076,7 +1085,6 @@ struct XclChTick struct XclChAxis { - XclChRectangle maRect; /// Position (not used). sal_uInt16 mnType; /// Axis type. explicit XclChAxis(); @@ -1089,7 +1097,7 @@ struct XclChAxis struct XclChAxesSet { - XclChRectangle maRect; /// Position of the axes set. + XclChRectangle maRect; /// Position of the axes set (inner plot area). sal_uInt16 mnAxesSetId; /// Primary/secondary axes set. explicit XclChAxesSet(); @@ -1158,16 +1166,6 @@ enum XclChFrameType EXC_CHFRAMETYPE_INVISIBLE /// Missing frame represents invisible formatting. }; -/** Enumerates different text box types for default text formatting. */ -enum XclChTextType -{ - EXC_CHTEXTTYPE_TITLE, /// Chart title. - EXC_CHTEXTTYPE_LEGEND, /// Chart legend. - EXC_CHTEXTTYPE_AXISTITLE, /// Chart axis titles. - EXC_CHTEXTTYPE_AXISLABEL, /// Chart axis labels. - EXC_CHTEXTTYPE_DATALABEL /// Data point labels. -}; - /** Contains information about auto formatting of a specific chart object type. */ struct XclChFormatInfo { @@ -1298,6 +1296,30 @@ private: XclChTypeInfoMap maInfoMap; /// Maps chart types to type info data. }; +// Chart text and title object helpers ======================================== + +/** Enumerates different text box types for default text formatting and title + positioning. */ +enum XclChTextType +{ + EXC_CHTEXTTYPE_TITLE, /// Chart title. + EXC_CHTEXTTYPE_LEGEND, /// Chart legend. + EXC_CHTEXTTYPE_AXISTITLE, /// Chart axis titles. + EXC_CHTEXTTYPE_AXISLABEL, /// Chart axis labels. + EXC_CHTEXTTYPE_DATALABEL /// Data point labels. +}; + +/** A map key for text and title objects. */ +struct XclChTextKey : public ::std::pair< XclChTextType, ::std::pair< sal_uInt16, sal_uInt16 > > +{ + inline explicit XclChTextKey( XclChTextType eTextType, sal_uInt16 nMainIdx = 0, sal_uInt16 nSubIdx = 0 ) + { first = eTextType; second.first = nMainIdx; second.second = nSubIdx; } +}; + +/** Function prototype receiving a chart document and returning a title shape. */ +typedef ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + (*XclChGetShapeFunc)( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDocument >& ); + // Property helpers =========================================================== class XclChObjectTable @@ -1363,10 +1385,6 @@ public: sal_uInt16 ReadRotationProperties( const ScfPropertySet& rPropSet, bool bSupportsStacked ); - /** Reads all legend properties from the passed property set. */ - void ReadLegendProperties( - XclChLegend& rLegend, - const ScfPropertySet& rPropSet ); /** Writes all line properties to the passed property set. */ void WriteLineProperties( @@ -1397,10 +1415,6 @@ public: ScfPropertySet& rPropSet, sal_uInt16 nRotation, bool bSupportsStacked ); - /** Writes all legend properties to the passed property set. */ - void WriteLegendProperties( - ScfPropertySet& rPropSet, - const XclChLegend& rLegend ); private: /** Returns a line property set helper according to the passed property mode. */ @@ -1423,51 +1437,47 @@ private: ScfPropSetHelper maHatchHlpCommon; /// Properties for hatches in common objects. ScfPropSetHelper maHatchHlpFilled; /// Properties for hatches in filled series. ScfPropSetHelper maBitmapHlp; /// Properties for bitmaps. - ScfPropSetHelper maLegendHlp; /// Properties for legend. }; // ============================================================================ /** Base struct for internal root data structs for import and export. */ -class XclChRootData +struct XclChRootData { -public: - typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef; + typedef ScfRef< XclChTypeInfoProvider > XclChTypeProvRef; + typedef ScfRef< XclChFormatInfoProvider > XclChFmtInfoProvRef; + typedef ScfRef< XclChObjectTable > XclChObjectTableRef; + typedef ::std::map< XclChTextKey, XclChGetShapeFunc > XclChGetShapeFuncMap; + + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > + mxChartDoc; /// The chart document. + Rectangle maChartRect; /// Position and size of the chart shape. + XclChTypeProvRef mxTypeInfoProv; /// Provides info about chart types. + XclChFmtInfoProvRef mxFmtInfoProv; /// Provides info about auto formatting. + XclChObjectTableRef mxLineDashTable; /// Container for line dash styles. + XclChObjectTableRef mxGradientTable; /// Container for gradient fill styles. + XclChObjectTableRef mxHatchTable; /// Container for hatch fill styles. + XclChObjectTableRef mxBitmapTable; /// Container for bitmap fill styles. + XclChGetShapeFuncMap maGetShapeFuncs; /// Maps title shape getter functions. + sal_Int32 mnBorderGapX; /// Border gap to chart space in 1/100mm. + sal_Int32 mnBorderGapY; /// Border gap to chart space in 1/100mm. + double mfUnitSizeX; /// Size of a chart X unit (1/4000 of chart width) in 1/100 mm. + double mfUnitSizeY; /// Size of a chart Y unit (1/4000 of chart height) in 1/100 mm. -public: explicit XclChRootData(); virtual ~XclChRootData(); - /** Returns the API reference of the chart document. */ - XChartDocRef GetChartDoc() const; - - /** Returns the chart type info provider, that contains data about all chart types. */ - inline XclChTypeInfoProvider& GetTypeInfoProvider() const { return *mxTypeInfoProv; } - /** Returns the chart type info provider, that contains data about all chart types. */ - inline XclChFormatInfoProvider& GetFormatInfoProvider() const { return *mxFmtInfoProv; } - - inline XclChObjectTable& GetLineDashTable() const { return *mxLineDashTable; } - inline XclChObjectTable& GetGradientTable() const { return *mxGradientTable; } - inline XclChObjectTable& GetHatchTable() const { return *mxHatchTable; } - inline XclChObjectTable& GetBitmapTable() const { return *mxBitmapTable; } - /** Starts the API chart document conversion. Must be called once before any API access. */ - void InitConversion( XChartDocRef xChartDoc ); + void InitConversion( + const XclRoot& rRoot, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + const Rectangle& rChartRect ); /** Finishes the API chart document conversion. Must be called once before any API access. */ void FinishConversion(); -private: - typedef ScfRef< XclChTypeInfoProvider > XclChTypeProvRef; - typedef ScfRef< XclChFormatInfoProvider > XclChFmtInfoProvRef; - typedef ScfRef< XclChObjectTable > XclChObjectTableRef; - - XChartDocRef mxChartDoc; /// The chart document. - XclChTypeProvRef mxTypeInfoProv; /// Provides info about chart types. - XclChFmtInfoProvRef mxFmtInfoProv; /// Provides info about auto formatting. - XclChObjectTableRef mxLineDashTable; /// Container for line dash styles. - XclChObjectTableRef mxGradientTable; /// Container for gradient fill styles. - XclChObjectTableRef mxHatchTable; /// Container for hatch fill styles. - XclChObjectTableRef mxBitmapTable; /// Container for bitmap fill styles. + /** Returns the drawing shape interface of the specified title object. */ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + GetTitleShape( const XclChTextKey& rTitleKey ) const; }; // ============================================================================ diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index f3b0f78a948c..2f029c74baa9 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -113,6 +113,8 @@ struct XclRootData XclTracerRef mxTracer; /// Filter tracer. RootDataRef mxRD; /// Old RootData struct. Will be removed. + double mfScreenPixelX; /// Width of a screen pixel (1/100 mm). + double mfScreenPixelY; /// Height of a screen pixel (1/100 mm). long mnCharWidth; /// Width of '0' in default font (twips). SCTAB mnScTab; /// Current Calc sheet index. const bool mbExport; /// false = Import, true = Export. @@ -177,6 +179,11 @@ public: /** Returns the current Calc sheet index. */ inline SCTAB GetCurrScTab() const { return mrData.mnScTab; } + /** Calculates the width of the passed number of pixels in 1/100 mm. */ + sal_Int32 GetHmmFromPixelX( double fPixelX ) const; + /** Calculates the height of the passed number of pixels in 1/100 mm. */ + sal_Int32 GetHmmFromPixelY( double fPixelY ) const; + /** Returns the medium to import from. */ inline SfxMedium& GetMedium() const { return mrData.mrMedium; } /** Returns the document URL of the imported/exported file. */ diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx index ce1f58f5d912..083a73d81872 100644 --- a/sc/source/filter/xml/xmlexternaltabi.cxx +++ b/sc/source/filter/xml/xmlexternaltabi.cxx @@ -370,7 +370,7 @@ SvXMLImportContext* ScXMLExternalRefCellContext::CreateChildContext( const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowCellElemTokenMap(); sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName); if (nToken == XML_TOK_TABLE_ROW_CELL_P) - return new ScXMLExternalRefCellTextContext(mrScImport, nPrefix, rLocalName, xAttrList, maCellString); + return new ScXMLExternalRefCellTextContext(mrScImport, nPrefix, rLocalName, xAttrList, *this); return new SvXMLImportContext(GetImport(), nPrefix, rLocalName); } @@ -399,14 +399,20 @@ void ScXMLExternalRefCellContext::EndElement() } } +void ScXMLExternalRefCellContext::SetCellString(const OUString& rStr) +{ + maCellString = rStr; +} + // ============================================================================ ScXMLExternalRefCellTextContext::ScXMLExternalRefCellTextContext( ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName, - const Reference<XAttributeList>& /*xAttrList*/, OUString& rCellString ) : + const Reference<XAttributeList>& /*xAttrList*/, + ScXMLExternalRefCellContext& rParent ) : SvXMLImportContext( rImport, nPrefix, rLName ), mrScImport(rImport), - mrCellString(rCellString) + mrParent(rParent) { } @@ -422,9 +428,10 @@ SvXMLImportContext* ScXMLExternalRefCellTextContext::CreateChildContext( void ScXMLExternalRefCellTextContext::Characters(const OUString& rChar) { - mrCellString = rChar; + maCellStrBuf.append(rChar); } void ScXMLExternalRefCellTextContext::EndElement() { + mrParent.SetCellString(maCellStrBuf.makeStringAndClear()); } diff --git a/sc/source/filter/xml/xmlexternaltabi.hxx b/sc/source/filter/xml/xmlexternaltabi.hxx index 0007a8b29702..6aaff181315e 100644 --- a/sc/source/filter/xml/xmlexternaltabi.hxx +++ b/sc/source/filter/xml/xmlexternaltabi.hxx @@ -29,6 +29,7 @@ #define SC_XMLEXTERNALTABI_HXX #include <xmloff/xmlictxt.hxx> +#include "rtl/ustrbuf.hxx" class ScXMLImport; struct ScXMLExternalTabData; @@ -129,6 +130,8 @@ public: virtual void EndElement(); + void SetCellString(const ::rtl::OUString& rStr); + private: ScXMLImport& mrScImport; ScXMLExternalTabData& mrExternalRefInfo; @@ -150,7 +153,7 @@ public: const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, - ::rtl::OUString& rCellString ); + ScXMLExternalRefCellContext& rParent ); virtual ~ScXMLExternalRefCellTextContext(); @@ -165,7 +168,9 @@ public: private: ScXMLImport& mrScImport; - ::rtl::OUString& mrCellString; + ScXMLExternalRefCellContext& mrParent; + + ::rtl::OUStringBuffer maCellStrBuf; }; #endif diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index 9afc08308feb..095b6ee6d450 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -98,21 +98,27 @@ static bool lcl_isExternalRefCache(const rtl::OUString& rName, rtl::OUString& rU const sal_Unicode c = p[i]; if (i <= 7) { + // Checking the prefix 'file://'. if (c != aPrefix[i]) return false; } - else if (c == '#') + else if (bInUrl) { - if (cPrev != '\'') - return false; + // parsing file URL + if (c == '#') + { + if (cPrev != '\'') + return false; - rUrl = aUrlBuf.makeStringAndClear(); - rUrl = rUrl.copy(0, rUrl.getLength()-1); // remove the trailing single-quote. - bInUrl = false; + rUrl = aUrlBuf.makeStringAndClear(); + rUrl = rUrl.copy(0, rUrl.getLength()-1); // remove the trailing single-quote. + bInUrl = false; + } + else + aUrlBuf.append(c); } - else if (bInUrl) - aUrlBuf.append(c); else + // parsing sheet name. aTabNameBuf.append(c); cPrev = c; @@ -206,6 +212,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport, ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); pExternalRefInfo->mnFileId = pRefMgr->getExternalFileId(aExtUrl); pExternalRefInfo->mpCacheTable = pRefMgr->getCacheTable(pExternalRefInfo->mnFileId, aExtTabName, true); + pExternalRefInfo->mpCacheTable->setWholeTableCached(); } } else diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 01d03d49b50a..e08c930301cf 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -98,9 +98,11 @@ #include "scui_def.hxx" //CHINA001 #include "tabprotection.hxx" #include "clipparam.hxx" +#include "externalrefmgr.hxx" #include <memory> #include <basic/basmgr.hxx> +#include <boost/scoped_ptr.hpp> using namespace com::sun::star; using ::com::sun::star::uno::Sequence; @@ -1042,6 +1044,10 @@ BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText, { if ( bEnglish ) { + ::boost::scoped_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard; + if (bApi) + pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(pDoc)); + // code moved to own method InterpretEnglishString because it is also used in // ScCellRangeObj::setFormulaArray diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index e7b04afa9c4f..0569e95605b1 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -65,6 +65,8 @@ #include <memory> #include <algorithm> +#include <boost/scoped_ptr.hpp> + using ::std::auto_ptr; using ::com::sun::star::uno::Any; using ::rtl::OUString; @@ -135,6 +137,69 @@ private: ScExternalRefManager::LinkUpdateType meType; }; +struct UpdateFormulaCell : public unary_function<ScFormulaCell*, void> +{ + void operator() (ScFormulaCell* pCell) const + { + // Check to make sure the cell really contains ocExternalRef. + // External names, external cell and range references all have a + // ocExternalRef token. + const ScTokenArray* pCode = pCell->GetCode(); + if (!pCode->HasOpCode( ocExternalRef)) + return; + + ScTokenArray* pArray = pCell->GetCode(); + if (pArray) + // Clear the error code, or a cell with error won't get re-compiled. + pArray->SetCodeError(0); + + pCell->SetCompile(true); + pCell->CompileTokenArray(); + pCell->SetDirty(); + } +}; + +class RemoveFormulaCell : public unary_function<pair<const sal_uInt16, ScExternalRefManager::RefCellSet>, void> +{ +public: + explicit RemoveFormulaCell(ScFormulaCell* p) : mpCell(p) {} + void operator() (pair<const sal_uInt16, ScExternalRefManager::RefCellSet>& r) const + { + r.second.erase(mpCell); + } +private: + ScFormulaCell* mpCell; +}; + +class ConvertFormulaToStatic : public unary_function<ScFormulaCell*, void> +{ +public: + explicit ConvertFormulaToStatic(ScDocument* pDoc) : mpDoc(pDoc) {} + void operator() (ScFormulaCell* pCell) const + { + ScAddress aPos = pCell->aPos; + + // We don't check for empty cells because empty external cells are + // treated as having a value of 0. + + if (pCell->IsValue()) + { + // Turn this into value cell. + double fVal = pCell->GetValue(); + mpDoc->PutCell(aPos, new ScValueCell(fVal)); + } + else + { + // string cell otherwise. + String aVal; + pCell->GetString(aVal); + mpDoc->PutCell(aPos, new ScStringCell(aVal)); + } + } +private: + ScDocument* mpDoc; +}; + } // ============================================================================ @@ -170,7 +235,7 @@ bool ScExternalRefCache::Table::isReferenced() const return meReferenced != UNREFERENCED; } -void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex) +void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex, bool bSetCacheRange) { using ::std::pair; RowsDataType::iterator itrRow = maRows.find(nRow); @@ -193,6 +258,8 @@ void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, aCell.mxToken = pToken; aCell.mnFmtIndex = nFmtIndex; rRow.insert(RowDataType::value_type(nCol, aCell)); + if (bSetCacheRange) + setCachedCell(nCol, nRow); } ScExternalRefCache::TokenRef ScExternalRefCache::Table::getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex) const @@ -201,7 +268,7 @@ ScExternalRefCache::TokenRef ScExternalRefCache::Table::getCell(SCCOL nCol, SCRO if (itrTable == maRows.end()) { // this table doesn't have the specified row. - return TokenRef(); + return getEmptyOrNullToken(nCol, nRow); } const RowDataType& rRowData = itrTable->second; @@ -209,7 +276,7 @@ ScExternalRefCache::TokenRef ScExternalRefCache::Table::getCell(SCCOL nCol, SCRO if (itrRow == rRowData.end()) { // this row doesn't have the specified column. - return TokenRef(); + return getEmptyOrNullToken(nCol, nRow); } const Cell& rCell = itrRow->second; @@ -225,13 +292,14 @@ bool ScExternalRefCache::Table::hasRow( SCROW nRow ) const return itrRow != maRows.end(); } -void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows) const +void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows, SCROW nLow, SCROW nHigh) const { vector<SCROW> aRows; aRows.reserve(maRows.size()); RowsDataType::const_iterator itr = maRows.begin(), itrEnd = maRows.end(); for (; itr != itrEnd; ++itr) - aRows.push_back(itr->first); + if (nLow <= itr->first && itr->first <= nHigh) + aRows.push_back(itr->first); // hash map is not ordered, so we need to explicitly sort it. ::std::sort(aRows.begin(), aRows.end()); @@ -258,7 +326,7 @@ void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows) const return aRange; } -void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) const +void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols, SCCOL nLow, SCCOL nHigh) const { RowsDataType::const_iterator itrRow = maRows.find(nRow); if (itrRow == maRows.end()) @@ -270,7 +338,8 @@ void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) con aCols.reserve(rRowData.size()); RowDataType::const_iterator itrCol = rRowData.begin(), itrColEnd = rRowData.end(); for (; itrCol != itrColEnd; ++itrCol) - aCols.push_back(itrCol->first); + if (nLow <= itrCol->first && itrCol->first <= nHigh) + aCols.push_back(itrCol->first); // hash map is not ordered, so we need to explicitly sort it. ::std::sort(aCols.begin(), aCols.end()); @@ -319,6 +388,54 @@ void ScExternalRefCache::Table::getAllNumberFormats(vector<sal_uInt32>& rNumFmts } } +const ScRangeList& ScExternalRefCache::Table::getCachedRanges() const +{ + return maCachedRanges; +} + +bool ScExternalRefCache::Table::isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const +{ + return maCachedRanges.In(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0)); +} + +void ScExternalRefCache::Table::setCachedCell(SCCOL nCol, SCROW nRow) +{ + setCachedCellRange(nCol, nRow, nCol, nRow); +} + +void ScExternalRefCache::Table::setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) +{ + ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0); + if (!maCachedRanges.Count()) + maCachedRanges.Append(aRange); + else + maCachedRanges.Join(aRange); + + String aStr; + maCachedRanges.Format(aStr, SCA_VALID); +} + +void ScExternalRefCache::Table::setWholeTableCached() +{ + setCachedCellRange(0, 0, MAXCOL, MAXROW); +} + +bool ScExternalRefCache::Table::isInCachedRanges(SCCOL nCol, SCROW nRow) const +{ + return maCachedRanges.In(ScRange(nCol, nRow, 0, nCol, nRow, 0)); +} + +ScExternalRefCache::TokenRef ScExternalRefCache::Table::getEmptyOrNullToken( + SCCOL nCol, SCROW nRow) const +{ + if (isInCachedRanges(nCol, nRow)) + { + TokenRef p(new ScEmptyCellToken(false, false)); + return p; + } + return TokenRef(); +} + // ---------------------------------------------------------------------------- ScExternalRefCache::TableName::TableName(const String& rUpper, const String& rReal) : @@ -383,8 +500,7 @@ const String* ScExternalRefCache::getRealRangeName(sal_uInt16 nFileId, const Str } ScExternalRefCache::TokenRef ScExternalRefCache::getCellData( - sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, - bool bEmptyCellOnNull, bool bWriteEmpty, sal_uInt32* pnFmtIndex) + sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex) { DocDataType::const_iterator itrDoc = maDocs.find(nFileId); if (itrDoc == maDocs.end()) @@ -409,18 +525,11 @@ ScExternalRefCache::TokenRef ScExternalRefCache::getCellData( return TokenRef(); } - TokenRef pToken = pTableData->getCell(nCol, nRow, pnFmtIndex); - if (!pToken && bEmptyCellOnNull) - { - pToken.reset(new ScEmptyCellToken(false, false)); - if (bWriteEmpty) - pTableData->setCell(nCol, nRow, pToken); - } - return pToken; + return pTableData->getCell(nCol, nRow, pnFmtIndex); } ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( - sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull, bool bWriteEmpty) + sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange) { DocDataType::iterator itrDoc = maDocs.find(nFileId); if (itrDoc == maDocs.end()) @@ -450,13 +559,14 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( return TokenArrayRef(); ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId)); + RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange); if (itrRange != rDoc.maRangeArrays.end()) - { + // Cache hit! return itrRange->second; - } - TokenArrayRef pArray(new ScTokenArray); + ::boost::scoped_ptr<ScRange> pNewRange; + TokenArrayRef pArray; bool bFirstTab = true; for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab) { @@ -464,27 +574,72 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( if (!pTab.get()) return TokenArrayRef(); + SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2; + SCROW nDataRow1 = nRow1, nDataRow2 = nRow2; + + if (!pTab->isRangeCached(nDataCol1, nDataRow1, nDataCol2, nDataRow2)) + { + // specified range is not entirely within cached ranges. + return TokenArrayRef(); + } + ScMatrixRef xMat = new ScMatrix( - static_cast<SCSIZE>(nCol2-nCol1+1), static_cast<SCSIZE>(nRow2-nRow1+1)); + static_cast<SCSIZE>(nDataCol2-nDataCol1+1), static_cast<SCSIZE>(nDataRow2-nDataRow1+1)); - for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) +#if 0 + // TODO: Switch to this code block once we have support for sparsely-filled + // matrices in ScMatrix. + + // Only fill non-empty cells, for better performance. + vector<SCROW> aRows; + pTab->getAllRows(aRows, nDataRow1, nDataRow2); + for (vector<SCROW>::const_iterator itr = aRows.begin(), itrEnd = aRows.end(); itr != itrEnd; ++itr) { - for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) + SCROW nRow = *itr; + vector<SCCOL> aCols; + pTab->getAllCols(nRow, aCols, nDataCol1, nDataCol2); + for (vector<SCCOL>::const_iterator itrCol = aCols.begin(), itrColEnd = aCols.end(); itrCol != itrColEnd; ++itrCol) { + SCCOL nCol = *itrCol; TokenRef pToken = pTab->getCell(nCol, nRow); if (!pToken) + // This should never happen! + return TokenArrayRef(); + + SCSIZE nC = nCol - nDataCol1, nR = nRow - nDataRow1; + switch (pToken->GetType()) { - if (bEmptyCellOnNull) - { - pToken.reset(new ScEmptyCellToken(false, false)); - if (bWriteEmpty) - pTab->setCell(nCol, nRow, pToken); - } - else - return TokenArrayRef(); + case svDouble: + xMat->PutDouble(pToken->GetDouble(), nC, nR); + break; + case svString: + xMat->PutString(pToken->GetString(), nC, nR); + break; + default: + ; } + } + } +#else + vector<SCROW> aRows; + pTab->getAllRows(aRows, nDataRow1, nDataRow2); + if (aRows.empty()) + // Cache is empty. + return TokenArrayRef(); + else + // Trim the column below the last non-empty row. + nDataRow2 = aRows.back(); + // Empty all matrix elements first, and fill only non-empty elements. + for (SCROW nRow = nDataRow1; nRow <= nDataRow2; ++nRow) + { + for (SCCOL nCol = nDataCol1; nCol <= nDataCol2; ++nCol) + { + TokenRef pToken = pTab->getCell(nCol, nRow); SCSIZE nC = nCol - nCol1, nR = nRow - nRow1; + if (!pToken) + return TokenArrayRef(); + switch (pToken->GetType()) { case svDouble: @@ -498,17 +653,27 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( } } } +#endif if (!bFirstTab) pArray->AddOpCode(ocSep); ScMatrix* pMat2 = xMat; ScMatrixToken aToken(pMat2); + if (!pArray) + pArray.reset(new ScTokenArray); pArray->AddToken(aToken); bFirstTab = false; + + if (!pNewRange) + pNewRange.reset(new ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0)); + else + pNewRange->ExtendTo(ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0)); } - rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray)); + + if (pNewRange) + rDoc.maRangeArrays.insert( RangeArrayMap::value_type(*pNewRange, pArray)); return pArray; } @@ -539,7 +704,7 @@ void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const String& rN pDoc->maRealRangeNameMap.insert(NamePairMap::value_type(aUpperName, rName)); } -void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol, +void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex) { if (!isDocInitialized(nFileId)) @@ -564,6 +729,7 @@ void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const String& rTabName, pTableData.reset(new Table); pTableData->setCell(nCol, nRow, pToken, nFmtIndex); + pTableData->setCachedCell(nCol, nRow); } void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const vector<SingleRangeData>& rData, @@ -609,20 +775,27 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa SCSIZE nC = nCol - nCol1, nR = nRow - nRow1; TokenRef pToken; const ScMatrixRef& pMat = itrData->mpRangeData; + if (pMat->IsEmpty(nC, nR)) + // Don't cache empty cells. + continue; + if (pMat->IsValue(nC, nR)) pToken.reset(new formula::FormulaDoubleToken(pMat->GetDouble(nC, nR))); else if (pMat->IsString(nC, nR)) pToken.reset(new formula::FormulaStringToken(pMat->GetString(nC, nR))); - else - pToken.reset(new ScEmptyCellToken(false, false)); - pTabData->setCell(nCol, nRow, pToken); + if (pToken) + // Don't mark this cell 'cached' here, for better performance. + pTabData->setCell(nCol, nRow, pToken, 0, false); } } + // Mark the whole range 'cached'. + pTabData->setCachedCellRange(nCol1, nRow1, nCol2, nRow2); } size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab(); ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId)); + rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray)); } @@ -1019,6 +1192,9 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF { // specified table found. if( pnIndex ) *pnIndex = nIndex; + if (bCreateNew && !rDoc.maTables[nIndex]) + rDoc.maTables[nIndex].reset(new Table); + return rDoc.maTables[nIndex]; } @@ -1186,11 +1362,11 @@ static FormulaToken* lcl_convertToToken(ScBaseCell* pCell) return NULL; } -static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, const ScRange& rRange, +static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, ScRange& rRange, vector<ScExternalRefCache::SingleRangeData>& rCacheData) { - const ScAddress& s = rRange.aStart; - const ScAddress& e = rRange.aEnd; + ScAddress& s = rRange.aStart; + ScAddress& e = rRange.aEnd; SCTAB nTab1 = s.Tab(), nTab2 = e.Tab(); SCCOL nCol1 = s.Col(), nCol2 = e.Col(); @@ -1204,19 +1380,35 @@ static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, const ScRange& // range to it. return NULL; + ::boost::scoped_ptr<ScRange> pUsedRange; + auto_ptr<ScTokenArray> pArray(new ScTokenArray); bool bFirstTab = true; vector<ScExternalRefCache::SingleRangeData>::iterator itrCache = rCacheData.begin(), itrCacheEnd = rCacheData.end(); + for (SCTAB nTab = nTab1; nTab <= nTab2 && itrCache != itrCacheEnd; ++nTab, ++itrCache) { + // Only loop within the data area. + SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2; + SCROW nDataRow1 = nRow1, nDataRow2 = nRow2; + if (!pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2)) + // no data within specified range. + continue; + + if (pUsedRange.get()) + // Make sure the used area only grows, not shrinks. + pUsedRange->ExtendTo(ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0)); + else + pUsedRange.reset(new ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0)); + ScMatrixRef xMat = new ScMatrix( - static_cast<SCSIZE>(nCol2-nCol1+1), - static_cast<SCSIZE>(nRow2-nRow1+1)); + static_cast<SCSIZE>(nDataCol2-nDataCol1+1), + static_cast<SCSIZE>(nDataRow2-nDataRow1+1)); - for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) + for (SCCOL nCol = nDataCol1; nCol <= nDataCol2; ++nCol) { - for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) + for (SCROW nRow = nDataRow1; nRow <= nDataRow2; ++nRow) { SCSIZE nC = nCol - nCol1, nR = nRow - nRow1; ScBaseCell* pCell; @@ -1283,12 +1475,38 @@ static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, const ScRange& bFirstTab = false; } + + if (!pUsedRange.get()) + return NULL; + + s.SetCol(pUsedRange->aStart.Col()); + s.SetRow(pUsedRange->aStart.Row()); + e.SetCol(pUsedRange->aEnd.Col()); + e.SetRow(pUsedRange->aEnd.Row()); + + return pArray.release(); +} + +static ScTokenArray* lcl_fillEmptyMatrix(const ScRange& rRange) +{ + SCSIZE nC = static_cast<SCSIZE>(rRange.aEnd.Col()-rRange.aStart.Col()+1); + SCSIZE nR = static_cast<SCSIZE>(rRange.aEnd.Row()-rRange.aStart.Row()+1); + ScMatrixRef xMat = new ScMatrix(nC, nR); + for (SCSIZE i = 0; i < nC; ++i) + for (SCSIZE j = 0; j < nR; ++j) + xMat->PutEmpty(i, j); + + ScMatrix* pMat2 = xMat; + ScMatrixToken aToken(pMat2); + auto_ptr<ScTokenArray> pArray(new ScTokenArray); + pArray->AddToken(aToken); return pArray.release(); } ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) : mpDoc(pDoc), - bInReferenceMarking(false) + mbInReferenceMarking(false), + mbUserInteractionEnabled(true) { maSrcDocTimer.SetTimeoutHdl( LINK(this, ScExternalRefManager, TimeOutHdl) ); maSrcDocTimer.SetTimeout(SRCDOC_SCAN_INTERVAL); @@ -1316,236 +1534,28 @@ ScExternalRefCache::TableTypeRef ScExternalRefManager::getCacheTable(sal_uInt16 // ============================================================================ -ScExternalRefManager::RefCells::TabItem::TabItem(SCTAB nIndex) : - mnIndex(nIndex) -{ -} - -ScExternalRefManager::RefCells::TabItem::TabItem(const TabItem& r) : - mnIndex(r.mnIndex), - maCols(r.maCols) -{ -} - -ScExternalRefManager::RefCells::RefCells() -{ -} - -ScExternalRefManager::RefCells::~RefCells() -{ -} - -list<ScExternalRefManager::RefCells::TabItemRef>::iterator ScExternalRefManager::RefCells::getTabPos(SCTAB nTab) -{ - list<TabItemRef>::iterator itr = maTables.begin(), itrEnd = maTables.end(); - for (; itr != itrEnd; ++itr) - if ((*itr)->mnIndex >= nTab) - return itr; - // Not found. return the end position. - return itrEnd; -} - -void ScExternalRefManager::RefCells::insertCell(const ScAddress& rAddr) -{ - SCTAB nTab = rAddr.Tab(); - SCCOL nCol = rAddr.Col(); - SCROW nRow = rAddr.Row(); - - // Search by table index. - list<TabItemRef>::iterator itrTab = getTabPos(nTab); - TabItemRef xTabRef; - if (itrTab == maTables.end()) - { - // All previous tables come before the specificed table. - xTabRef.reset(new TabItem(nTab)); - maTables.push_back(xTabRef); - } - else if ((*itrTab)->mnIndex > nTab) - { - // Insert at the current iterator position. - xTabRef.reset(new TabItem(nTab)); - maTables.insert(itrTab, xTabRef); - } - else if ((*itrTab)->mnIndex == nTab) - { - // The table found. - xTabRef = *itrTab; - } - ColSet& rCols = xTabRef->maCols; - - // Then by column index. - ColSet::iterator itrCol = rCols.find(nCol); - if (itrCol == rCols.end()) - { - RowSet aRows; - pair<ColSet::iterator, bool> r = rCols.insert(ColSet::value_type(nCol, aRows)); - if (!r.second) - // column insertion failed. - return; - itrCol = r.first; - } - RowSet& rRows = itrCol->second; - - // Finally, insert the row index. - rRows.insert(nRow); -} - -void ScExternalRefManager::RefCells::removeCell(const ScAddress& rAddr) -{ - SCTAB nTab = rAddr.Tab(); - SCCOL nCol = rAddr.Col(); - SCROW nRow = rAddr.Row(); - - // Search by table index. - list<TabItemRef>::iterator itrTab = getTabPos(nTab); - if (itrTab == maTables.end() || (*itrTab)->mnIndex != nTab) - // No such table. - return; - - ColSet& rCols = (*itrTab)->maCols; - - // Then by column index. - ColSet::iterator itrCol = rCols.find(nCol); - if (itrCol == rCols.end()) - // No such column - return; - - RowSet& rRows = itrCol->second; - rRows.erase(nRow); -} - -void ScExternalRefManager::RefCells::moveTable(SCTAB nOldTab, SCTAB nNewTab, bool bCopy) -{ - if (nOldTab == nNewTab) - // Nothing to do here. - return; - - list<TabItemRef>::iterator itrOld = getTabPos(nOldTab); - if (itrOld == maTables.end() || (*itrOld)->mnIndex != nOldTab) - // No table to move or copy. - return; - - list<TabItemRef>::iterator itrNew = getTabPos(nNewTab); - if (bCopy) - { - // Simply make a duplicate of the original table, insert it at the - // new tab position, and increment the table index for all tables - // that come after that inserted table. - - TabItemRef xNewTab(new TabItem(*(*itrOld))); - xNewTab->mnIndex = nNewTab; - maTables.insert(itrNew, xNewTab); - list<TabItemRef>::iterator itr = itrNew, itrEnd = maTables.end(); - if (itr != itrEnd) // #i99807# check that itr is not at end already - for (++itr; itr != itrEnd; ++itr) - (*itr)->mnIndex += 1; - } - else - { - if (itrOld == itrNew) - { - // No need to move the table. Just update the table index. - (*itrOld)->mnIndex = nNewTab; - return; - } - - if (nOldTab < nNewTab) - { - // Iterate from the old tab position to the new tab position (not - // inclusive of the old tab itself), and decrement their tab - // index by one. - list<TabItemRef>::iterator itr = itrOld; - for (++itr; itr != itrNew; ++itr) - (*itr)->mnIndex -= 1; - - // Insert a duplicate of the original table. This does not - // invalidate the iterators. - (*itrOld)->mnIndex = nNewTab - 1; - if (itrNew == maTables.end()) - maTables.push_back(*itrOld); - else - maTables.insert(itrNew, *itrOld); - - // Remove the original table. - maTables.erase(itrOld); - } - else - { - // nNewTab < nOldTab - - // Iterate from the new tab position to the one before the old tab - // position, and increment their tab index by one. - list<TabItemRef>::iterator itr = itrNew; - for (++itr; itr != itrOld; ++itr) - (*itr)->mnIndex += 1; - - (*itrOld)->mnIndex = nNewTab; - maTables.insert(itrNew, *itrOld); - - // Remove the original table. - maTables.erase(itrOld); - } - } -} - -void ScExternalRefManager::RefCells::insertTable(SCTAB nPos) -{ - TabItemRef xNewTab(new TabItem(nPos)); - list<TabItemRef>::iterator itr = getTabPos(nPos); - if (itr == maTables.end()) - maTables.push_back(xNewTab); - else - maTables.insert(itr, xNewTab); -} - -void ScExternalRefManager::RefCells::removeTable(SCTAB nPos) +ScExternalRefManager::LinkListener::LinkListener() { - list<TabItemRef>::iterator itr = getTabPos(nPos); - if (itr == maTables.end()) - // nothing to remove. - return; - - maTables.erase(itr); } -void ScExternalRefManager::RefCells::refreshAllCells(ScExternalRefManager& rRefMgr) +ScExternalRefManager::LinkListener::~LinkListener() { - // Get ALL the cell positions for re-compilation. - for (list<TabItemRef>::iterator itrTab = maTables.begin(), itrTabEnd = maTables.end(); - itrTab != itrTabEnd; ++itrTab) - { - SCTAB nTab = (*itrTab)->mnIndex; - ColSet& rCols = (*itrTab)->maCols; - for (ColSet::iterator itrCol = rCols.begin(), itrColEnd = rCols.end(); - itrCol != itrColEnd; ++itrCol) - { - SCCOL nCol = itrCol->first; - RowSet& rRows = itrCol->second; - RowSet aNewRows; - for (RowSet::iterator itrRow = rRows.begin(), itrRowEnd = rRows.end(); - itrRow != itrRowEnd; ++itrRow) - { - SCROW nRow = *itrRow; - ScAddress aCell(nCol, nRow, nTab); - if (rRefMgr.compileTokensByCell(aCell)) - // This cell still contains an external refernce. - aNewRows.insert(nRow); - } - // Update the rows so that cells with no external references are - // no longer tracked. - rRows.swap(aNewRows); - } - } } // ---------------------------------------------------------------------------- -ScExternalRefManager::LinkListener::LinkListener() +ScExternalRefManager::ApiGuard::ApiGuard(ScDocument* pDoc) : + mpMgr(pDoc->GetExternalRefManager()), + mbOldInteractionEnabled(mpMgr->mbUserInteractionEnabled) { + // We don't want user interaction handled in the API. + mpMgr->mbUserInteractionEnabled = false; } -ScExternalRefManager::LinkListener::~LinkListener() +ScExternalRefManager::ApiGuard::~ApiGuard() { + // Restore old value. + mpMgr->mbUserInteractionEnabled = mbOldInteractionEnabled; } // ---------------------------------------------------------------------------- @@ -1595,9 +1605,22 @@ bool ScExternalRefManager::markUsedByLinkListeners() return bAllMarked; } -bool ScExternalRefManager::setCacheDocReferenced( sal_uInt16 nFileId ) +bool ScExternalRefManager::markUsedExternalRefCells() { - return maRefCache.setCacheDocReferenced( nFileId); + RefCellMap::iterator itr = maRefCells.begin(), itrEnd = maRefCells.end(); + for (; itr != itrEnd; ++itr) + { + RefCellSet::iterator itrCell = itr->second.begin(), itrCellEnd = itr->second.end(); + for (; itrCell != itrCellEnd; ++itrCell) + { + ScFormulaCell* pCell = *itrCell; + bool bUsed = pCell->MarkUsedExternalReferences(); + if (bUsed) + // Return true when at least one cell references external docs. + return true; + } + } + return false; } bool ScExternalRefManager::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ) @@ -1617,7 +1640,7 @@ void ScExternalRefManager::setCacheTableReferencedPermanently( sal_uInt16 nFileI void ScExternalRefManager::setAllCacheTableReferencedStati( bool bReferenced ) { - bInReferenceMarking = !bReferenced; + mbInReferenceMarking = !bReferenced; maRefCache.setAllCacheTableReferencedStati( bReferenced ); } @@ -1642,20 +1665,13 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken( if (pFmt) pFmt->mbIsSet = false; - bool bLoading = mpDoc->IsImportingXML(); - // Check if the given table name and the cell position is cached. - // #i101304# When loading a file, the saved cache (hidden sheet) - // is assumed to contain all data for the loaded formulas. - // No cache entries are created from empty cells in the saved sheet, - // so they have to be created here (bWriteEmpty parameter). - // Otherwise, later interpretation of the loaded formulas would - // load the source document even if the user didn't want to update. sal_uInt32 nFmtIndex = 0; ScExternalRefCache::TokenRef pToken = maRefCache.getCellData( - nFileId, rTabName, rCell.Col(), rCell.Row(), bLoading, bLoading, &nFmtIndex); + nFileId, rTabName, rCell.Col(), rCell.Row(), &nFmtIndex); if (pToken) { + // Cache hit ! if (pFmt) { short nFmtType = mpDoc->GetFormatTable()->GetType(nFmtIndex); @@ -1673,11 +1689,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken( ScDocument* pSrcDoc = getSrcDocument(nFileId); if (!pSrcDoc) { - // Source document is not reachable. Try to get data from the cache - // once again, but this time treat a non-cached cell as an empty cell - // as long as the table itself is cached. - pToken = maRefCache.getCellData( - nFileId, rTabName, rCell.Col(), rCell.Row(), true, false, &nFmtIndex); + // Source document not reachable. Throw a reference error. + pToken.reset(new FormulaErrorToken(errNoRef)); return pToken; } @@ -1686,12 +1699,30 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken( if (!pSrcDoc->GetTable(rTabName, nTab)) { // specified table name doesn't exist in the source document. - return ScExternalRefCache::TokenRef(); + pToken.reset(new FormulaErrorToken(errNoRef)); + return pToken; } if (pTab) *pTab = nTab; + SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL; + SCROW nDataRow1 = 0, nDataRow2 = MAXROW; + pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2); + if (rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row()) + { + // requested cell is outside the data area. Don't even bother caching + // this data, but add it to the cached range to prevent accessing the + // source document time and time again. + ScExternalRefCache::TableTypeRef pCacheTab = + maRefCache.getCacheTable(nFileId, rTabName, true, NULL); + if (pCacheTab) + pCacheTab->setCachedCell(rCell.Col(), rCell.Row()); + + pToken.reset(new ScEmptyCellToken(false, false)); + return pToken; + } + pSrcDoc->GetCell(rCell.Col(), rCell.Row(), nTab, pCell); ScExternalRefCache::TokenRef pTok(lcl_convertToToken(pCell)); @@ -1714,39 +1745,45 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken( pTok.reset( new FormulaErrorToken( errNoValue)); } - // Now, insert the token into cache table. - maRefCache.setCellData(nFileId, rTabName, rCell.Row(), rCell.Col(), pTok, nFmtIndex); + // Now, insert the token into cache table but don't cache empty cells. + if (pTok->GetType() != formula::svEmptyCell) + maRefCache.setCellData(nFileId, rTabName, rCell.Col(), rCell.Row(), pTok, nFmtIndex); + return pTok; } -ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos) +ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens( + sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos) { if (pCurPos) insertRefCell(nFileId, *pCurPos); maybeLinkExternalFile(nFileId); - bool bLoading = mpDoc->IsImportingXML(); - // Check if the given table name and the cell position is cached. - // #i101304# When loading, put empty cells into cache, see getSingleRefToken. - ScExternalRefCache::TokenArrayRef p = maRefCache.getCellRangeData(nFileId, rTabName, rRange, bLoading, bLoading); - if (p.get()) - return p; + ScExternalRefCache::TokenArrayRef pArray = + maRefCache.getCellRangeData(nFileId, rTabName, rRange); + if (pArray) + // Cache hit ! + return pArray; ScDocument* pSrcDoc = getSrcDocument(nFileId); if (!pSrcDoc) { - // Source document is not reachable. Try to get data from the cache - // once again, but this time treat non-cached cells as empty cells as - // long as the table itself is cached. - return maRefCache.getCellRangeData(nFileId, rTabName, rRange, true, false); + // Source document is not reachable. Throw a reference error. + pArray.reset(new ScTokenArray); + pArray->AddToken(FormulaErrorToken(errNoRef)); + return pArray; } SCTAB nTab1; if (!pSrcDoc->GetTable(rTabName, nTab1)) + { // specified table name doesn't exist in the source document. - return ScExternalRefCache::TokenArrayRef(); + pArray.reset(new ScTokenArray); + pArray->AddToken(FormulaErrorToken(errNoRef)); + return pArray; + } ScRange aRange(rRange); SCTAB nTabSpan = aRange.aEnd.Tab() - aRange.aStart.Tab(); @@ -1770,12 +1807,24 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(sal_u aRange.aStart.SetTab(nTab1); aRange.aEnd.SetTab(nTab1 + nTabSpan); - ScExternalRefCache::TokenArrayRef pArray; pArray.reset(lcl_convertToTokenArray(pSrcDoc, aRange, aCacheData)); if (pArray) // Cache these values. - maRefCache.setCellRangeData(nFileId, rRange, aCacheData, pArray); + maRefCache.setCellRangeData(nFileId, aRange, aCacheData, pArray); + else + { + // Array is empty. Fill it with an empty matrix of the required size. + pArray.reset(lcl_fillEmptyMatrix(rRange)); + + // Make sure to set this range 'cached', to prevent unnecessarily + // accessing the src document time and time again. + ScExternalRefCache::TableTypeRef pCacheTab = + maRefCache.getCacheTable(nFileId, rTabName, true, NULL); + if (pCacheTab) + pCacheTab->setCachedCellRange( + rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row()); + } return pArray; } @@ -1858,8 +1907,8 @@ void ScExternalRefManager::refreshAllRefCells(sal_uInt16 nFileId) if (itrFile == maRefCells.end()) return; - RefCells& rRefCells = itrFile->second; - rRefCells.refreshAllCells(*this); + RefCellSet& rRefCells = itrFile->second; + for_each(rRefCells.begin(), rRefCells.end(), UpdateFormulaCell()); ScViewData* pViewData = ScDocShell::GetViewData(); if (!pViewData) @@ -1880,7 +1929,7 @@ void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rC RefCellMap::iterator itr = maRefCells.find(nFileId); if (itr == maRefCells.end()) { - RefCells aRefCells; + RefCellSet aRefCells; pair<RefCellMap::iterator, bool> r = maRefCells.insert( RefCellMap::value_type(nFileId, aRefCells)); if (!r.second) @@ -1889,7 +1938,10 @@ void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rC itr = r.first; } - itr->second.insertCell(rCell); + + ScBaseCell* pCell = mpDoc->GetCell(rCell); + if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA) + itr->second.insert(static_cast<ScFormulaCell*>(pCell)); } ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId) @@ -1902,6 +1954,12 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId) if (itr != itrEnd) { + // document already loaded. + + // TODO: Find out a way to access a document that's already open in + // memory and re-use that instance, instead of loading it from the + // disk again. + SfxObjectShell* p = itr->second.maShell; itr->second.maLastAccess = Time(); return static_cast<ScDocShell*>(p)->GetDocument(); @@ -1996,7 +2054,8 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri if (pMedium->GetError() != ERRCODE_NONE) return NULL; - pMedium->UseInteractionHandler(false); + // To load encrypted documents with password, user interaction needs to be enabled. + pMedium->UseInteractionHandler(mbUserInteractionEnabled); ScDocShell* pNewShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL); SfxObjectShellRef aRef = pNewShell; @@ -2005,6 +2064,10 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri ScExtDocOptions* pExtOpt = mpDoc->GetExtDocOptions(); sal_uInt32 nLinkCount = pExtOpt ? pExtOpt->GetDocSettings().mnLinkCnt : 0; ScDocument* pSrcDoc = pNewShell->GetDocument(); + pSrcDoc->EnableExecuteLink(false); // to prevent circular access of external references. + pSrcDoc->EnableUndo(false); + pSrcDoc->EnableAdjustHeight(false); + ScExtDocOptions* pExtOptNew = pSrcDoc->GetExtDocOptions(); if (!pExtOptNew) { @@ -2082,35 +2145,6 @@ void ScExternalRefManager::maybeCreateRealFileName(sal_uInt16 nFileId) maSrcFiles[nFileId].maybeCreateRealFileName(getOwnDocumentName()); } -bool ScExternalRefManager::compileTokensByCell(const ScAddress& rCell) -{ - ScBaseCell* pCell; - mpDoc->GetCell(rCell.Col(), rCell.Row(), rCell.Tab(), pCell); - - if (!pCell || pCell->GetCellType() != CELLTYPE_FORMULA) - return false; - - ScFormulaCell* pFC = static_cast<ScFormulaCell*>(pCell); - - // Check to make sure the cell really contains ocExternalRef. - // External names, external cell and range references all have a - // ocExternalRef token. - const ScTokenArray* pCode = pFC->GetCode(); - if (!pCode->HasOpCode( ocExternalRef)) - return false; - - ScTokenArray* pArray = pFC->GetCode(); - if (pArray) - // Clear the error code, or a cell with error won't get re-compiled. - pArray->SetCodeError(0); - - pFC->SetCompile(true); - pFC->CompileTokenArray(); - pFC->SetDirty(); - - return true; -} - const String& ScExternalRefManager::getOwnDocumentName() const { SfxObjectShell* pShell = mpDoc->GetDocumentShell(); @@ -2222,6 +2256,18 @@ void ScExternalRefManager::refreshNames(sal_uInt16 nFileId) void ScExternalRefManager::breakLink(sal_uInt16 nFileId) { + // Turn all formula cells referencing this external document into static + // cells. + RefCellMap::iterator itrRefs = maRefCells.find(nFileId); + if (itrRefs != maRefCells.end()) + { + // Make a copy because removing the formula cells below will modify + // the original container. + RefCellSet aSet = itrRefs->second; + for_each(aSet.begin(), aSet.end(), ConvertFormulaToStatic(mpDoc)); + maRefCells.erase(nFileId); + } + lcl_removeByFileId(nFileId, maDocShells); if (maDocShells.empty()) @@ -2293,32 +2339,9 @@ void ScExternalRefManager::resetSrcFileData(const String& rBaseFileUrl) } } -void ScExternalRefManager::updateRefCell(const ScAddress& rOldPos, const ScAddress& rNewPos, bool bCopy) -{ - for (RefCellMap::iterator itr = maRefCells.begin(), itrEnd = maRefCells.end(); itr != itrEnd; ++itr) - { - if (!bCopy) - itr->second.removeCell(rOldPos); - itr->second.insertCell(rNewPos); - } -} - -void ScExternalRefManager::updateRefMoveTable(SCTAB nOldTab, SCTAB nNewTab, bool bCopy) -{ - for (RefCellMap::iterator itr = maRefCells.begin(), itrEnd = maRefCells.end(); itr != itrEnd; ++itr) - itr->second.moveTable(nOldTab, nNewTab, bCopy); -} - -void ScExternalRefManager::updateRefInsertTable(SCTAB nPos) -{ - for (RefCellMap::iterator itr = maRefCells.begin(), itrEnd = maRefCells.end(); itr != itrEnd; ++itr) - itr->second.insertTable(nPos); -} - -void ScExternalRefManager::updateRefDeleteTable(SCTAB nPos) +void ScExternalRefManager::removeRefCell(ScFormulaCell* pCell) { - for (RefCellMap::iterator itr = maRefCells.begin(), itrEnd = maRefCells.end(); itr != itrEnd; ++itr) - itr->second.removeTable(nPos); + for_each(maRefCells.begin(), maRefCells.end(), RemoveFormulaCell(pCell)); } void ScExternalRefManager::addLinkListener(sal_uInt16 nFileId, LinkListener* pListener) diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index ece7c4ad6c3a..bfbeba2d1302 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -32,6 +32,9 @@ //------------------------------------------------------------------------- +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/lang/Locale.hpp> + #include "scitems.hxx" #include <editeng/adjitem.hxx> @@ -46,6 +49,7 @@ #include <svx/hlnkitem.hxx> #include <editeng/lspcitem.hxx> #include <svx/svdoutl.hxx> +#include <editeng/unolingu.hxx> #include <editeng/outlobj.hxx> #include <editeng/postitem.hxx> #include <editeng/scripttypeitem.hxx> @@ -71,6 +75,7 @@ #include "sc.hrc" #include "globstr.hrc" +#include "scmod.hxx" #include "drtxtob.hxx" #include "fudraw.hxx" #include "viewdata.hxx" @@ -83,6 +88,10 @@ #define ScDrawTextObjectBar #include "scslots.hxx" + +using namespace ::com::sun::star; + + SFX_IMPL_INTERFACE( ScDrawTextObjectBar, SfxShell, ScResId(SCSTR_DRAWTEXTSHELL) ) { SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER, @@ -363,6 +372,24 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq ) ExecuteGlobal( rReq ); break; #endif + + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOutView->GetEditView(), aReplaceText ); + } + break; + + case SID_THESAURUS: + { + pOutView->StartThesaurus(); + } + break; + } } @@ -454,6 +481,25 @@ void __EXPORT ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) rSet.Put( SfxBoolItem( SID_ENABLE_HYPHENATION, bValue ) ); } } + + if ( rSet.GetItemState( SID_THES ) != SFX_ITEM_UNKNOWN || + rSet.GetItemState( SID_THESAURUS ) != SFX_ITEM_UNKNOWN ) + { + SdrView * pView = pViewData->GetScDrawView(); + EditView & rEditView = pView->GetTextEditOutlinerView()->GetEditView(); + + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable thesaurus main menu and context menu entry if there is nothing to look up + BOOL bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); + if (!bIsLookUpWord || !bCanDoThesaurus) + rSet.DisableItem( SID_THES ); + if (!bCanDoThesaurus) + rSet.DisableItem( SID_THESAURUS ); + } } IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pDataHelper ) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index afe29a8309a7..980a73307797 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5265,6 +5265,8 @@ void SAL_CALL ScCellRangeObj::setFormulaArray( ScDocShell* pDocSh = GetDocShell(); if (pDocSh) { + ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument()); + // GRAM_PODF_A1 for API compatibility. bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 ); } diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index 6d9fcd1d23e4..a119eda13a32 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -1605,12 +1605,16 @@ ScExternalDocLinkObj::~ScExternalDocLinkObj() } Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinkObj::addSheetCache( - const OUString& aSheetName ) + const OUString& aSheetName, sal_Bool bDynamicCache ) throw (RuntimeException) { ScUnoGuard aGuard; size_t nIndex = 0; ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aSheetName, true, &nIndex); + if (!bDynamicCache) + // Set the whole table cached to prevent access to the source document. + pTable->setWholeTableCached(); + Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(pTable, nIndex)); return aSheetCache; } diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index fc14b53a6372..5e3b3102e14a 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -140,9 +140,11 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( if (mpDocShell) { + ScDocument* pDoc = mpDocShell->GetDocument(); + ScExternalRefManager::ApiGuard aExtRefGuard(pDoc); + ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); - ScDocument* pDoc = mpDocShell->GetDocument(); ScCompiler aCompiler( pDoc, aRefPos); aCompiler.SetGrammar(pDoc->GetGrammar()); SetCompilerFlags( aCompiler ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index d228a205a5a3..848a0a3c7636 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -32,13 +32,16 @@ //------------------------------------------------------------------ +#include <com/sun/star/linguistic2/XThesaurus.hpp> + #include "scitems.hxx" #include <editeng/eeitem.hxx> #include <svx/clipfmtitem.hxx> #include <svx/svxdlg.hxx> #include <editeng/cntritem.hxx> -//CHINA001 #include <svx/chardlg.hxx> +#include <editeng/outliner.hxx> +#include <editeng/unolingu.hxx> #include <editeng/crsditem.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> @@ -91,6 +94,11 @@ #include "scui_def.hxx" //CHINA001 #include "scabstdlg.hxx" //CHINA001 + + +using namespace ::com::sun::star; + + TYPEINIT1( ScEditShell, SfxShell ); SFX_IMPL_INTERFACE(ScEditShell, SfxShell, ScResId(SCSTR_EDITSHELL)) @@ -213,6 +221,17 @@ void ScEditShell::Execute( SfxRequest& rReq ) } break; + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( *pEditView, aReplaceText ); + } + break; + case SID_COPY: pTableView->Copy(); break; @@ -680,6 +699,22 @@ void __EXPORT ScEditShell::GetState( SfxItemSet& rSet ) case SID_INSERT_ZWSP: ScViewUtil::HideDisabledSlot( rSet, pViewData->GetBindings(), nWhich ); break; + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, *pActiveView ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable thesaurus context menu entry if there is nothing to look up + BOOL bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); + if (!bIsLookUpWord || !bCanDoThesaurus) + rSet.DisableItem( SID_THES ); + } + break; + + } nWhich = aIter.NextWhich(); } diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 5a48d0d310d5..37bc941c0f16 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -623,7 +623,7 @@ long ScDrawStringsVars::GetMaxDigitWidth() return nMaxDigitWidth; sal_Char cZero = '0'; - for (int i = 0; i < 10; ++i) + for (sal_Char i = 0; i < 10; ++i) { sal_Char cDigit = cZero + i; long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit)); diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index f73346398ea1..d887aec8bc5b 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -52,6 +52,8 @@ #include <svl/eitem.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> + #include "viewutil.hxx" #include "global.hxx" @@ -120,6 +122,15 @@ sal_Int32 ScViewUtil::GetTransliterationType( USHORT nSlotID ) sal_Int32 nType = 0; switch ( nSlotID ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nType = com::sun::star::i18n::TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nType = com::sun::star::i18n::TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nType = com::sun::star::i18n::TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nType = com::sun::star::i18n::TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index 949b1a10b619..da8e6efdad55 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -234,8 +234,11 @@ <menu:menuitem menu:id=".uno:ParagraphDialog"/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> @@ -311,7 +314,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:HangulHanjaConversion"/> <menu:menuitem menu:id=".uno:ChineseConversion"/> - <menu:menuitem menu:id=".uno:Thesaurus"/> + <menu:menuitem menu:id=".uno:ThesaurusDialog"/> <menu:menuitem menu:id=".uno:Hyphenate"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MoreDictionaries"/> diff --git a/sc/uiconfig/scalc/toolbar/findbar.xml b/sc/uiconfig/scalc/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sc/uiconfig/scalc/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/sc/uiconfig/scalc/toolbar/toolbar.xml b/sc/uiconfig/scalc/toolbar/toolbar.xml index 6a34de3a4ebd..e42964a86b0b 100644 --- a/sc/uiconfig/scalc/toolbar/toolbar.xml +++ b/sc/uiconfig/scalc/toolbar/toolbar.xml @@ -8,7 +8,7 @@ <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:AutoFormat" toolbar:helpid="helpid:10242" /> <toolbar:toolbaritem xlink:href=".uno:ChooseDesign" toolbar:helpid="helpid:26082" /> - <toolbar:toolbaritem xlink:href=".uno:Thesaurus" toolbar:helpid="helpid:10245" toolbar:visible="false" /> + <toolbar:toolbaritem xlink:href=".uno:ThesaurusDialog" toolbar:helpid="helpid:10245" toolbar:visible="false" /> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:DataFilterAutoFilter" toolbar:helpid="helpid:26325" /> <toolbar:toolbaritem xlink:href=".uno:DataFilterStandardFilter" toolbar:helpid="helpid:26323" toolbar:visible="false" /> @@ -20,4 +20,4 @@ <toolbar:toolbaritem xlink:href=".uno:GoalSeekDialog" toolbar:helpid="helpid:26153" toolbar:visible="false" /> <toolbar:toolbaritem xlink:href=".uno:Group" toolbar:helpid="helpid:26331" /> <toolbar:toolbaritem xlink:href=".uno:Ungroup" toolbar:helpid="helpid:26332" /> -</toolbar:toolbar>
\ No newline at end of file +</toolbar:toolbar> diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index d72fda64f6f2..11173e1f37fc 100755 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -1030,6 +1030,12 @@ File gid_File_Lm_Yiddish_Utf Styles = (PACKED); End +File gid_File_Lm_Zulu + TXT_FILE_BODY; + Name = "zulu.lm"; + Dir = gid_Dir_Share_Fingerprint; + Styles = (PACKED); +End diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index 38eeb0b47272..a4ab3bfab762 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -606,6 +606,7 @@ Module gid_Module_Root_Files_6 gid_File_Lm_Vietnamese, gid_File_Lm_Welsh, gid_File_Lm_Yiddish_Utf, + gid_File_Lm_Zulu, gid_File_Mod_Chart, gid_File_Mod_Datastyl, gid_File_Mod_Defs, diff --git a/scp2/source/python/file_python.scp b/scp2/source/python/file_python.scp index 1303bf59460f..5cd84d82b3e9 100644 --- a/scp2/source/python/file_python.scp +++ b/scp2/source/python/file_python.scp @@ -83,11 +83,17 @@ End File gid_File_Py_Python_Core TXT_FILE_BODY; Dir = gid_Dir_Program; + #ifdef MACOSX + Name = "OOoPython.framework.zip"; + Styles = (ARCHIVE,USE_INTERNAL_RIGHTS); + #else Name = STRING(CONCAT3(python-core-,PYVERSION,.zip)); Styles = (ARCHIVE); + #endif End #ifdef UNX +#ifndef MACOSX File gid_File_Py_Python_Bin BIN_FILE_BODY; Dir = gid_Dir_Program; @@ -96,6 +102,7 @@ File gid_File_Py_Python_Bin End #endif #endif +#endif // Scripting Framework Python script proxy @@ -126,12 +133,163 @@ File gid_File_Share_Registry_Pyuno_Xcd End #ifndef SYSTEM_PYTHON +#ifndef MACOSX File gid_File_Lib_Python_So TXT_FILE_BODY; Dir = gid_Dir_Program; Name = STRING(PY_FULL_DLL_NAME); Styles = (PACKED); End +#else //MACOSX +//directory entries solely to be able to create the symlinks +Directory gid_Dir_PythonFramework + ParentID = gid_Dir_Program; + HostName = "OOoPython.framework"; +End + +Unixlink gid_Unixlink_Python_Headers + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework; + Name = "Headers"; + Target = "Versions/Current/Headers"; + Styles = (); +End + +Unixlink gid_Unixlink_Python_Resources + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework; + Name = "Resources"; + Target = "Versions/Current/Resources"; + Styles = (); +End + +Directory gid_Dir_PythonFramework_Versions + ParentID = gid_Dir_PythonFramework; + HostName = "Versions"; +End + +Unixlink gid_Unixlink_Python_Versions_Current + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions; + Name = "Current"; + Target = STRING(PYMAJMIN); + Styles = (); +End + +Directory gid_Dir_PythonFramework_Versions_ver + ParentID = gid_Dir_PythonFramework_Versions; + HostName = STRING(PYMAJMIN); +End + +Unixlink gid_Unixlink_Python_Versions_ver_Headers + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver; + Name = "Headers"; + Target = STRING(CONCAT2(include/python,PYMAJMIN)); + Styles = (); +End + +Directory gid_Dir_PythonFramework_Versions_ver_bin + ParentID = gid_Dir_PythonFramework_Versions_ver; + HostName = "bin"; +End + +Directory gid_Dir_PythonFramework_Versions_ver_lib + ParentID = gid_Dir_PythonFramework_Versions_ver; + HostName = "lib"; +End + +Directory gid_Dir_PythonFramework_Versions_ver_lib_pythonver + ParentID = gid_Dir_PythonFramework_Versions_ver_lib; + HostName = STRING(CONCAT2(python,PYMAJMIN)); +End + +Directory gid_Dir_PythonFramework_Versions_ver_lib_pythonver_config + ParentID = gid_Dir_PythonFramework_Versions_ver_lib_pythonver; + HostName = "config"; +End + +Unixlink gid_Unixlink_Python_OOoPython + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework; + Name = "OOoPython"; + Target = "Versions/Current/OOoPython"; + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_idle + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "idle"; + Target = STRING(CONCAT2(idle,PYMAJMIN)); + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_pydoc + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "pydoc"; + Target = STRING(CONCAT2(pydoc,PYMAJMIN)); + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_python_real + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "python"; + Target = "../Resources/Python.app/Contents/MacOS/OOoPython"; + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_python + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "python"; + Target = STRING(CONCAT2(python,PYMAJMIN)); + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_pythonconfig + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "python-config"; + Target = STRING(CONCAT3(python,PYMAJMIN,-config)); + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_pythonw_real + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "pythonw"; + Target = "../Resources/Python.app/Contents/MacOS/OOoPython"; + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_pythonw + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "pythonw"; + Target = STRING(CONCAT2(pythonw,PYMAJMIN)); + Styles = (); +End + +Unixlink gid_Unixlink_Python_bin_smtpdpy + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_bin; + Name = "smtpd.py"; + Target = STRING(CONCAT3(smtpd,PYMAJMIN,.py)); + Styles = (); +End + +Unixlink gid_Unixlink_Python_libpython + BIN_FILE_BODY; + Dir = gid_Dir_PythonFramework_Versions_ver_lib_pythonver_config; + Name = STRING(PY_FULL_DLL_NAME); + Target = "../../../OOoPython"; + Styles = (); +End +#endif //MACOSX + #ifdef WNT File gid_File_Lib_Python_So_Brand // Fix for system-python-problem on windows TXT_FILE_BODY; diff --git a/scp2/source/python/makefile.mk b/scp2/source/python/makefile.mk index b34c0af1491d..4e03218ff06a 100644 --- a/scp2/source/python/makefile.mk +++ b/scp2/source/python/makefile.mk @@ -44,7 +44,7 @@ SCPDEFS+=-DSYSTEM_PYTHON .ENDIF SCPDEFS+=\ - -DPYVERSION=$(PYVERSION) \ + -DPYVERSION=$(PYVERSION) -DPYMAJMIN=$(PYMAJOR).$(PYMINOR) \ -DPY_FULL_DLL_NAME=$(PY_FULL_DLL_NAME) SCP_PRODUCT_TYPE=osl diff --git a/scp2/source/python/profileitem_python.scp b/scp2/source/python/profileitem_python.scp index be8edc601eb6..1c4fdb077986 100644 --- a/scp2/source/python/profileitem_python.scp +++ b/scp2/source/python/profileitem_python.scp @@ -46,7 +46,11 @@ ProfileItem gid_Profileitem_Pythonloader_Pythonhome Section = "Bootstrap"; Order = 1; Key = "PYUNO_LOADER_PYTHONHOME"; + #ifdef MACOSX + Value = CONCAT2($ORIGIN,"OOoPython.framework"); + #else Value = CONCAT2($ORIGIN/python-core-,PYVERSION); + #endif End #endif @@ -60,11 +64,19 @@ ProfileItem gid_Profileitem_Pythonloader_Pythonpath Value = "$ORIGIN"; #else #ifdef UNX + #ifdef MACOSX + #define FRAMEWORKLIB CONCAT4($ORIGIN/OOoPython.framework/Versions/,PYMAJMIN,/lib/python,PYMAJMIN) + Value = CONCAT4(FRAMEWORKLIB FRAMEWORKLIB, + /lib-dynload FRAMEWORKLIB, + /lib-tk FRAMEWORKLIB, + /site-packages $ORIGIN); + #else Value = CONCAT9($ORIGIN/python-core-,PYVERSION, /lib $ORIGIN/python-core-,PYVERSION, /lib/lib-dynload $ORIGIN/python-core-,PYVERSION, /lib/lib-tk $ORIGIN/python-core-,PYVERSION, /lib/site-packages $ORIGIN); + #endif #else #ifdef _gcc3 Value = STRING(CONCAT9($ORIGIN/python-core-,PYVERSION, diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 53813365a686..6d0d3ef33ce9 100644..100755 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2173,6 +2173,21 @@ interface DrawView ExecMethod = FuSupport ; StateMethod = GetCtrlState ; ] + SID_TRANSLITERATE_SENTENCE_CASE // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetCtrlState ; + ] + SID_TRANSLITERATE_TITLE_CASE // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetCtrlState ; + ] + SID_TRANSLITERATE_TOGGLE_CASE // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetCtrlState ; + ] SID_TRANSLITERATE_LOWER // ole : no, status : ? [ ExecMethod = FuSupport ; diff --git a/sd/sdi/drtxtob.sdi b/sd/sdi/drtxtob.sdi index 4e2ca49c0b82..f4133f0f4643 100644..100755 --- a/sd/sdi/drtxtob.sdi +++ b/sd/sdi/drtxtob.sdi @@ -202,5 +202,11 @@ shell TextObjectBar ExecMethod = Execute; StateMethod = GetAttrState; ] + SID_THES + [ + ExecMethod = Execute ; + StateMethod = GetAttrState ; + ] + } diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi index 1632b2fa4163..9639f1adc9dc 100644..100755 --- a/sd/sdi/outlnvsh.sdi +++ b/sd/sdi/outlnvsh.sdi @@ -433,6 +433,21 @@ interface OutlineView ExecMethod = FuSupport ; StateMethod = GetMenuState ; ] + SID_TRANSLITERATE_SENTENCE_CASE // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetCtrlState ; + ] + SID_TRANSLITERATE_TITLE_CASE // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetCtrlState ; + ] + SID_TRANSLITERATE_TOGGLE_CASE // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetCtrlState ; + ] SID_TRANSLITERATE_UPPER // ole : no, status : ? [ ExecMethod = FuSupport ; diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 230feabe956a..b0eac4990c50 100755 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -29,6 +29,7 @@ #include "precompiled_sd.hxx" #include "DrawController.hxx" +#include "DrawDocShell.hxx" #include "DrawSubController.hxx" #include "sdpage.hxx" @@ -54,6 +55,7 @@ #include <svx/fmshell.hxx> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> +#include <boost/shared_ptr.hpp> using namespace ::std; using ::rtl::OUString; @@ -164,6 +166,16 @@ void SAL_CALL DrawController::dispose (void) { mbDisposing = true; + boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell(); + if ( pViewShell ) + { + pViewShell->DeactivateCurrentFunction(); + DrawDocShell* pDocShell = pViewShell->GetDocSh(); + if ( pDocShell != NULL ) + pDocShell->SetDocShellFunction(0); + } + pViewShell.reset(); + // When the controller has not been detached from its view // shell, i.e. mpViewShell is not NULL, then tell PaneManager // and ViewShellManager to clear the shell stack. diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index a7c9786dd160..fd07d966ad47 100755 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -568,7 +568,8 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) void Outliner::Initialize (bool bDirectionIsForward) { - bool bOldDirectionIsForward = mbDirectionIsForward; + const bool bIsAtEnd (maObjectIterator == ::sd::outliner::OutlinerContainer(this).end()); + const bool bOldDirectionIsForward = mbDirectionIsForward; mbDirectionIsForward = bDirectionIsForward; if (maObjectIterator == ::sd::outliner::Iterator()) @@ -603,10 +604,19 @@ void Outliner::Initialize (bool bDirectionIsForward) { // Requested iteration direction has changed. Turn arround the iterator. maObjectIterator.Reverse(); - // The iterator has pointed to the object one ahead/before the current - // one. Now move it to the one before/ahead the current one. - ++maObjectIterator; - ++maObjectIterator; + if (bIsAtEnd) + { + // The iterator has pointed to end(), which after the search + // direction is reversed, becomes begin(). + maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); + } + else + { + // The iterator has pointed to the object one ahead/before the current + // one. Now move it to the one before/ahead the current one. + ++maObjectIterator; + ++maObjectIterator; + } mbMatchMayExist = true; } diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index bcff1c573b14..8b88be3682e3 100644..100755 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -32,6 +32,14 @@ #include <svx/svxids.hrc> +#include <i18npool/mslangid.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/adjitem.hxx> +#include <editeng/editview.hxx> +#include <editeng/editeng.hxx> +#include <editeng/outliner.hxx> +#include <editeng/unolingu.hxx> #include <editeng/ulspitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/adjitem.hxx> @@ -39,6 +47,7 @@ #include <sfx2/app.hxx> #include <svl/whiter.hxx> #include <svl/itempool.hxx> +#include <svl/stritem.hxx> #include <svl/style.hxx> #include <svl/languageoptions.hxx> #include <sfx2/tplpitem.hxx> @@ -71,6 +80,8 @@ using namespace sd; +using namespace ::com::sun::star; + #define TextObjectBar #include "sdslots.hxx" @@ -371,6 +382,26 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } break; + case SID_THES: + { + EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();; + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + + //! avoid puting the same item as SfxBoolItem at the end of this function + nSlotId = 0; + } + break; + default: break; } diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 4ca26501fedb..4a6d83e376e7 100644..100755 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -30,8 +30,12 @@ #include "TextObjectBar.hxx" + #include <svx/svxids.hrc> +#include <editeng/editview.hxx> +#include <editeng/editeng.hxx> +#include <editeng/unolingu.hxx> #include <editeng/outliner.hxx> #include <editeng/ulspitem.hxx> #include <editeng/lspcitem.hxx> @@ -331,6 +335,16 @@ void TextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + } + break; default: { diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx index 54cd0c792c94..54cd0c792c94 100644..100755 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 1a667b28f6d4..6f6f49fdc93c 100644..100755 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -31,7 +31,8 @@ #include <com/sun/star/presentation/XPresentation2.hpp> #include <com/sun/star/form/FormButtonType.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/i18n/TransliterationModules.hdl> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <comphelper/processfactory.hxx> @@ -1401,6 +1402,9 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) } break; + case SID_TRANSLITERATE_SENTENCE_CASE: + case SID_TRANSLITERATE_TITLE_CASE: + case SID_TRANSLITERATE_TOGGLE_CASE: case SID_TRANSLITERATE_UPPER: case SID_TRANSLITERATE_LOWER: case SID_TRANSLITERATE_HALFWIDTH: @@ -1416,6 +1420,15 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) switch( nSId ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nType = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nType = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nType = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nType = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 0a5f743bb738..ac6b46f3018b 100644..100755 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -250,6 +250,9 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True ); } + rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE ); + rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE ); + rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE ); rSet.DisableItem( SID_TRANSLITERATE_UPPER ); rSet.DisableItem( SID_TRANSLITERATE_LOWER ); rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 2acf143ff0b3..2acf143ff0b3 100644..100755 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 1467e6c24bd0..bbdcf35a4e34 100644..100755 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -59,7 +59,8 @@ #include <svx/svdorect.hxx> #include <sot/formats.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/i18n/TransliterationModules.hdl> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <editeng/unolingu.hxx> #include <comphelper/processfactory.hxx> #include <editeng/outlobj.hxx> @@ -528,6 +529,9 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq) std::auto_ptr< OutlineViewModelChangeGuard > aGuard; if( pOlView && ( + (nSlot == SID_TRANSLITERATE_SENTENCE_CASE) || + (nSlot == SID_TRANSLITERATE_TITLE_CASE) || + (nSlot == SID_TRANSLITERATE_TOGGLE_CASE) || (nSlot == SID_TRANSLITERATE_UPPER) || (nSlot == SID_TRANSLITERATE_LOWER) || (nSlot == SID_TRANSLITERATE_HALFWIDTH) || @@ -661,6 +665,9 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq) } break; + case SID_TRANSLITERATE_SENTENCE_CASE: + case SID_TRANSLITERATE_TITLE_CASE: + case SID_TRANSLITERATE_TOGGLE_CASE: case SID_TRANSLITERATE_UPPER: case SID_TRANSLITERATE_LOWER: case SID_TRANSLITERATE_HALFWIDTH: @@ -676,6 +683,15 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq) switch( nSlot ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nType = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nType = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nType = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nType = TransliterationModules_LOWERCASE_UPPERCASE; break; @@ -988,7 +1004,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) GetDoc()->SetChanged(TRUE); } - // Da šberladen, muss hier der Status gesetzt werden + // Da �berladen, muss hier der Status gesetzt werden if( !GetDocSh()->IsModified() ) { rSet.DisableItem( SID_SAVEDOC ); diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 1373bfd60e10..91a69adeae6a 100755 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -186,12 +186,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuseparator/> diff --git a/sd/uiconfig/sdraw/toolbar/findbar.xml b/sd/uiconfig/sdraw/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sd/uiconfig/sdraw/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index 59bf75aa1025..90d5ac490aa4 100755 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -203,8 +203,11 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> @@ -239,7 +242,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:HangulHanjaConversion"/> <menu:menuitem menu:id=".uno:ChineseConversion"/> - <menu:menuitem menu:id=".uno:Thesaurus"/> + <menu:menuitem menu:id=".uno:ThesaurusDialog"/> <menu:menuitem menu:id=".uno:Hyphenation"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MoreDictionaries"/> diff --git a/sd/uiconfig/simpress/toolbar/findbar.xml b/sd/uiconfig/simpress/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sd/uiconfig/simpress/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/set_soenv.in b/set_soenv.in index 58c81ee568f1..7983933c655e 100644 --- a/set_soenv.in +++ b/set_soenv.in @@ -302,6 +302,47 @@ elsif ( $platform =~ m/netbsd/ ) $OS = "NETBSD"; $PATH_SEPERATOR = $ps; } +elsif ( $platform =~ m/kfreebsd/ ) +{ +# General GNU/kFreeBSD settings: + $CVER = "C341"; + $BIG_SVX = "TRUE"; + $COM = "GCC"; + $COMPATH = '@COMPATH@'; + $GLIBC = "2REDHAT60"; + $GUI = "UNX"; + $GUIBASE = "unx"; + $GVER = "VCL"; + $OS = "LINUX"; + $PATH_SEPERATOR = $ps; + +#Set platform specific values: + if ($platform =~ m/^i[3456]86/) + { print "Setting GNU/kFreeBSD x86 specific values... "; + $outfile = "GNUkFreeBSDX86Env.Set"; + $CPU = "I"; + $CPUNAME = "INTEL"; + $OUTPATH = "unxkfgi6"; + + $JRELIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386"; + $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client"; + $JRETHREADDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads"; + + } + elsif ($platform =~ m/^x86_64/) + { print "Setting GNU/kFreeBSD x86-64 specific values... "; + $outfile = "GNUkFreeBSDX86-64Env.Set"; + $CPU = "X"; + $CPUNAME = "X86_64"; + $OUTPATH = "unxkfgx6"; + + $JRELIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64"; + $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server"; + $JRETHREADDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads"; + } + + $INPATH = $OUTPATH.$PROEXT; +} elsif ( $platform =~ m/freebsd/ ) { $BIG_SVX = "TRUE"; $COM = "GCC"; diff --git a/sfx2/inc/sfx2/mnumgr.hxx b/sfx2/inc/sfx2/mnumgr.hxx index ee1c81daa603..9c9b566d9d9d 100644 --- a/sfx2/inc/sfx2/mnumgr.hxx +++ b/sfx2/inc/sfx2/mnumgr.hxx @@ -102,22 +102,34 @@ private: DECL_LINK( SelectHdl, void * ); Menu* pSVMenu; -private: - // only declared, but not defined: don't allow copying - SfxPopupMenuManager( const SfxPopupMenuManager& ); - SfxPopupMenuManager& operator=( const SfxPopupMenuManager& ); + // when #i107205 gets fixed this one should be superfluous. + // But right now we want to avoid the memory leak that would otherwise occur, + // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup + static PopupMenu * pStaticThesSubMenu; + + // only declared, but not defined: don't allow copying + SfxPopupMenuManager( const SfxPopupMenuManager& ); + SfxPopupMenuManager& operator=( const SfxPopupMenuManager& ); public: SfxPopupMenuManager( const ResId&, SfxBindings& ); SfxPopupMenuManager( PopupMenu*, SfxBindings& ); ~SfxPopupMenuManager(); static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, Window* pWindow ); + // @deprecated!! + // Don't use this method any longer. The whole class will be removed in the future. + // Changing code which relies on Popup would need much more effort. + // Please contact cd@openoffice.org if you have questions or need help static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, Window* pWindow ); USHORT Execute( const Point& rPos, Window *pWindow ); USHORT Execute( const Point& rPoint, Window* pWindow, va_list pArgs, const SfxPoolItem *pArg1 ); USHORT Execute( const Point& rPoint, Window* pWindow, const SfxPoolItem *pArg1 ... ); + // @deprecated (start)!! + // Don't use these methods any longer. The whole class will be removed in the future. + // Changing code which relies on these methods would need much more effort! + // Please contact cd@openoffice.org if you have questions or need help void StartInsert(); void EndInsert(); void CheckItem( USHORT, BOOL ); @@ -125,6 +137,8 @@ public: void InsertItem( USHORT, const String&, MenuItemBits, USHORT nPos = MENU_APPEND ); void InsertSeparator( USHORT nPos = MENU_APPEND ); + // @deprecated (end) + void RemoveDisabledEntries(); void AddClipboardFunctions(); Menu* GetSVMenu(); diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 41dceafc1756..275e5c06a7be 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -477,6 +477,9 @@ #define SID_CAPTION (SID_SFX_START + 641) #define SID_STATUSBARTEXT (SID_SFX_START + 642) +// id for thesaurs entry in context menu +#define SID_THES (SID_SFX_START + 698) + // default-ids for editing, cursor travellung and selection #define SID_REDO (SID_SFX_START + 700) #define SID_UNDO (SID_SFX_START + 701) diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst index 763c60810b3e..131156a78d4d 100644 --- a/sfx2/prj/build.lst +++ b/sfx2/prj/build.lst @@ -22,3 +22,4 @@ sf sfx2\source\explorer nmake - all sf_expl sf_sdi sf_inc NULL sf sfx2\workben\custompanel nmake - all sf_wb_custompanel NULL sf sfx2\util nmake - all sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_layout sf_noti sf_sbar sf_tbox sf_view NULL sf sfx2\qa\unoapi nmake - all sf_qa_unoapi NULL +sf sfx2\qa\cppunit nmake - all sf_qa_cppunit sf_util NULL diff --git a/sfx2/qa/cppunit/makefile.mk b/sfx2/qa/cppunit/makefile.mk new file mode 100644 index 000000000000..2794c2ae92bb --- /dev/null +++ b/sfx2/qa/cppunit/makefile.mk @@ -0,0 +1,74 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=../.. +PRJNAME=sfx2 +TARGET=qa_cppunit + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +CFLAGSCXX += $(CPPUNIT_CFLAGS) +DLLPRE = # no leading "lib" on .so files + +# --- Libs --------------------------------------------------------- + +SHL1OBJS= \ + $(SLO)/test_metadatable.obj \ + + +SHL1STDLIBS= \ + $(CPPUNITLIB) \ + $(SALLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VCLLIB) \ + $(SFXLIB) \ + + +SHL1TARGET= test_metadatable +SHL1RPATH = NONE +SHL1IMPLIB= i$(SHL1TARGET) +# SHL1DEF= $(MISC)/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +# DEF1EXPORTFILE= export.exp +SHL1VERSIONMAP= version.map + +# --- All object files --------------------------------------------- + +SLOFILES= \ + $(SHL1OBJS) \ + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk +.INCLUDE : _cppunit.mk + diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx new file mode 100644 index 000000000000..903be6920327 --- /dev/null +++ b/sfx2/qa/cppunit/test_metadatable.cxx @@ -0,0 +1,280 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <rtl/ustrbuf.hxx> + +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Duration.hpp> + +#include <sfx2/Metadatable.hxx> +#include <sfx2/XmlIdRegistry.hxx> + + +using namespace ::com::sun::star; + + +namespace { + +class MetadatableTest + : public ::CppUnit::TestFixture +{ +public: + virtual void setUp(); + virtual void tearDown(); + + void test(); + + CPPUNIT_TEST_SUITE(MetadatableTest); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); + +private: +}; + +void MetadatableTest::setUp() +{ +} + +void MetadatableTest::tearDown() +{ +} + + +class MockMetadatable + : public ::sfx2::Metadatable +{ +private: + ::sfx2::IXmlIdRegistry & m_rRegistry; + +public: + MockMetadatable(::sfx2::IXmlIdRegistry & i_rReg, + bool const i_isInClip = false) + : m_rRegistry(i_rReg) + , m_bInClipboard(i_isInClip), m_bInUndo(false), m_bInContent(true) {} + bool m_bInClipboard; + bool m_bInUndo; + bool m_bInContent; + virtual bool IsInClipboard() const { return m_bInClipboard; } + virtual bool IsInUndo() const { return m_bInUndo; } + virtual bool IsInContent() const { return m_bInContent; } + virtual ::sfx2::IXmlIdRegistry& GetRegistry() { return m_rRegistry; } + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > MakeUnoObject() { return 0; } +}; + +static bool operator==(beans::StringPair p1, beans::StringPair p2) +{ + return p1.First == p2.First && p1.Second == p2.Second; +} + +void MetadatableTest::test() +{ + OSL_TRACE("SwMetadatable test(): start\n"); + ::std::auto_ptr< ::sfx2::IXmlIdRegistry > const pReg( + ::sfx2::createXmlIdRegistry(false) ); + ::std::auto_ptr< ::sfx2::IXmlIdRegistry > const pRegClip( + ::sfx2::createXmlIdRegistry(true) ); + + MockMetadatable m1(*pReg); + MockMetadatable m2(*pReg); + MockMetadatable m3(*pReg); + MockMetadatable m4(*pReg); + MockMetadatable m5(*pReg); + ::rtl::OUString empty; + ::rtl::OUString content( ::rtl::OUString::createFromAscii("content.xml") ); + ::rtl::OUString styles ( ::rtl::OUString::createFromAscii("styles.xml") ); + ::rtl::OUString sid1( ::rtl::OUString::createFromAscii("id1") ); + ::rtl::OUString sid2( ::rtl::OUString::createFromAscii("id2") ); + ::rtl::OUString sid3( ::rtl::OUString::createFromAscii("id3") ); + ::rtl::OUString sid4( ::rtl::OUString::createFromAscii("id4") ); + beans::StringPair id1(content, sid1); + beans::StringPair id2(content, sid2); + beans::StringPair id3(content, sid3); + beans::StringPair id4(styles, sid4); + beans::StringPair id3e(empty, sid3); + beans::StringPair id4e(empty, sid4); + m1.SetMetadataReference(id1); + CPPUNIT_ASSERT_MESSAGE("set failed", m1.GetMetadataReference() == id1); + try { + m2.SetMetadataReference(id1); + CPPUNIT_ASSERT_MESSAGE("set duplicate succeeded", false); + } catch (lang::IllegalArgumentException) { } + m1.SetMetadataReference(id1); + CPPUNIT_ASSERT_MESSAGE("set failed (existing)", + m1.GetMetadataReference() == id1); + m1.EnsureMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("ensure failed (existing)", + m1.GetMetadataReference() == id1); + + m2.EnsureMetadataReference(); + beans::StringPair m2id(m2.GetMetadataReference()); + CPPUNIT_ASSERT_MESSAGE("ensure failed", m2id.Second.getLength()); + m2.EnsureMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("ensure failed (idempotent)", + m2.GetMetadataReference() == m2id); + + m1.m_bInUndo = true; + CPPUNIT_ASSERT_MESSAGE("move to undo failed", + !m1.GetMetadataReference().Second.getLength()); + + m1.m_bInUndo = false; + CPPUNIT_ASSERT_MESSAGE("move from undo failed", + m1.GetMetadataReference() == id1); + + m1.m_bInUndo = true; + try { + m2.SetMetadataReference(id1); // steal! + } catch (lang::IllegalArgumentException &) { + CPPUNIT_FAIL("set duplicate to undo failed"); + } + m1.m_bInUndo = false; + CPPUNIT_ASSERT_MESSAGE("move from undo: duplicate", + !m1.GetMetadataReference().Second.getLength()); + + m3.RegisterAsCopyOf(m2); + CPPUNIT_ASSERT_MESSAGE("copy: source", m2.GetMetadataReference() == id1); + CPPUNIT_ASSERT_MESSAGE("copy: duplicate", + !m3.GetMetadataReference().Second.getLength()); + m4.RegisterAsCopyOf(m3); + CPPUNIT_ASSERT_MESSAGE("copy: source", m2.GetMetadataReference() == id1); + CPPUNIT_ASSERT_MESSAGE("copy: duplicate", + !m3.GetMetadataReference().Second.getLength()); + CPPUNIT_ASSERT_MESSAGE("copy: duplicate", + !m4.GetMetadataReference().Second.getLength()); + m2.m_bInUndo = true; + CPPUNIT_ASSERT_MESSAGE("duplicate to undo", + m3.GetMetadataReference() == id1); + CPPUNIT_ASSERT_MESSAGE("duplicate to undo", + !m2.GetMetadataReference().Second.getLength()); + m2.m_bInUndo = false; + CPPUNIT_ASSERT_MESSAGE("duplicate from undo", + m2.GetMetadataReference() == id1); + CPPUNIT_ASSERT_MESSAGE("duplicate from undo", + !m3.GetMetadataReference().Second.getLength()); + + m4.EnsureMetadataReference(); // new! + beans::StringPair m4id(m4.GetMetadataReference()); + CPPUNIT_ASSERT_MESSAGE("ensure on duplicate", + m4id.Second.getLength() && !(m4id == id1)); + + MockMetadatable mc1(*pRegClip, true); // in clipboard + MockMetadatable mc2(*pRegClip, true); + MockMetadatable mc3(*pRegClip, true); + MockMetadatable mc4(*pRegClip, true); + MockMetadatable m2p(*pReg); + MockMetadatable m3p(*pReg); + + mc1.SetMetadataReference(id2); + CPPUNIT_ASSERT_MESSAGE("set failed", mc1.GetMetadataReference() == id2); + try { + mc2.SetMetadataReference(id2); + CPPUNIT_FAIL("set duplicate succeeded"); + } catch (lang::IllegalArgumentException) { } + mc1.SetMetadataReference(id2); + CPPUNIT_ASSERT_MESSAGE("set failed (existing)", + mc1.GetMetadataReference() == id2); + mc1.EnsureMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("ensure failed (existing)", + mc1.GetMetadataReference() == id2); + mc2.EnsureMetadataReference(); + beans::StringPair mc2id(mc2.GetMetadataReference()); + CPPUNIT_ASSERT_MESSAGE("ensure failed", mc2id.Second.getLength()); + mc2.EnsureMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("ensure failed (idempotent)", + mc2.GetMetadataReference() == mc2id); + mc2.RemoveMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("remove failed", + !mc2.GetMetadataReference().Second.getLength()); + + // set up mc2 as copy of m2 and mc3 as copy of m3 + mc3.RegisterAsCopyOf(m3); + CPPUNIT_ASSERT_MESSAGE("copy to clipboard (latent)", + !mc3.GetMetadataReference().Second.getLength() ); + mc2.RegisterAsCopyOf(m2); + CPPUNIT_ASSERT_MESSAGE("copy to clipboard (non-latent)", + mc2.GetMetadataReference() == id1); + // paste mc2 to m2p and mc3 to m3p + m2p.RegisterAsCopyOf(mc2); + CPPUNIT_ASSERT_MESSAGE("paste from clipboard (non-latent)", + !m2p.GetMetadataReference().Second.getLength() ); + m3p.RegisterAsCopyOf(mc3); + CPPUNIT_ASSERT_MESSAGE("paste from clipboard (latent)", + !m3p.GetMetadataReference().Second.getLength() ); + // delete m2, m2p, m3 + m2.RemoveMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("remove failed", + !m2.GetMetadataReference().Second.getLength()); + CPPUNIT_ASSERT_MESSAGE("paste-remove (non-latent)", + m2p.GetMetadataReference() == id1); + m2p.RemoveMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("remove failed", + !m2p.GetMetadataReference().Second.getLength()); + CPPUNIT_ASSERT_MESSAGE("paste-remove2 (non-latent)", + m3.GetMetadataReference() == id1); + m3.RemoveMetadataReference(); + CPPUNIT_ASSERT_MESSAGE("remove failed", + !m3.GetMetadataReference().Second.getLength()); + CPPUNIT_ASSERT_MESSAGE("paste-remove (latent)", + m3p.GetMetadataReference() == id1); + // delete mc2 + mc2.SetMetadataReference(beans::StringPair()); + CPPUNIT_ASSERT_MESSAGE("in clipboard becomes non-latent", + !mc3.GetMetadataReference().Second.getLength() ); + // paste mc2 + m2p.RegisterAsCopyOf(mc2); + CPPUNIT_ASSERT_MESSAGE("remove-paste", + !m2p.GetMetadataReference().Second.getLength()); + CPPUNIT_ASSERT_MESSAGE("remove-paste (stolen)", + m3p.GetMetadataReference() == id1); + + // auto-detect stream + m5.SetMetadataReference(id3e); + CPPUNIT_ASSERT_MESSAGE("auto-detect (content)", + m5.GetMetadataReference() == id3); + m5.m_bInContent = false; + m5.SetMetadataReference(id4e); + CPPUNIT_ASSERT_MESSAGE("auto-detect (styles)", + m5.GetMetadataReference() == id4); + + OSL_TRACE("sfx2::Metadatable test(): finished\n"); +} + + +CPPUNIT_TEST_SUITE_REGISTRATION(MetadatableTest); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + diff --git a/sfx2/qa/cppunit/version.map b/sfx2/qa/cppunit/version.map new file mode 100644 index 000000000000..3308588ef6f8 --- /dev/null +++ b/sfx2/qa/cppunit/version.map @@ -0,0 +1,34 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +UDK_3_0_0 { + global: + cppunitTestPlugIn; + + local: + *; +}; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index dbe7cdfbb7e1..e4e43c51052f 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -8221,3 +8221,29 @@ SfxInt16Item PasteUnformatted SID_PASTE_UNFORMATTED GroupId = GID_EDIT; ] +//-------------------------------------------------------------------------- +// call thesaurus dialog from context menu +SfxInt16Item ThesaurusFromContext SID_THES +(SfxStringItem WordReplace SID_THES) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_TEXT; +] + diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index 1a51bee5024f..94c5826569f2 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -1682,168 +1682,6 @@ throw (uno::RuntimeException) #if OSL_DEBUG_LEVEL > 1 -static ::sfx2::XmlIdRegistryDocument s_Reg; -static ::sfx2::XmlIdRegistryClipboard s_RegClip; - -class MockMetadatable : public ::sfx2::Metadatable -{ -public: - MockMetadatable(bool i_isInClip = false) : - m_bInClipboard(i_isInClip), m_bInUndo(false), m_bInContent(true) {} - bool m_bInClipboard; - bool m_bInUndo; - bool m_bInContent; - virtual bool IsInClipboard() const { return m_bInClipboard; } - virtual bool IsInUndo() const { return m_bInUndo; } - virtual bool IsInContent() const { return m_bInContent; } - virtual ::sfx2::XmlIdRegistry& GetRegistry() { return m_bInClipboard ? static_cast< ::sfx2::XmlIdRegistry&>(s_RegClip) : static_cast< ::sfx2::XmlIdRegistry&>(s_Reg); } - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::rdf::XMetadatable > MakeUnoObject() { return 0; } -}; - -bool operator==(beans::StringPair p1, beans::StringPair p2) -{ - return p1.First == p2.First && p1.Second == p2.Second; -} - -void test() -{ - OSL_TRACE("SwMetadatable test(): start\n"); - MockMetadatable m1; - MockMetadatable m2; - MockMetadatable m3; - MockMetadatable m4; - MockMetadatable m5; - ::rtl::OUString empty; - ::rtl::OUString content( ::rtl::OUString::createFromAscii("content.xml") ); - ::rtl::OUString styles ( ::rtl::OUString::createFromAscii("styles.xml") ); - ::rtl::OUString sid1( ::rtl::OUString::createFromAscii("id1") ); - ::rtl::OUString sid2( ::rtl::OUString::createFromAscii("id2") ); - ::rtl::OUString sid3( ::rtl::OUString::createFromAscii("id3") ); - ::rtl::OUString sid4( ::rtl::OUString::createFromAscii("id4") ); - beans::StringPair id1(content, sid1); - beans::StringPair id2(content, sid2); - beans::StringPair id3(content, sid3); - beans::StringPair id4(styles, sid4); - beans::StringPair id3e(empty, sid3); - beans::StringPair id4e(empty, sid4); - m1.SetMetadataReference(id1); - OSL_ENSURE(m1.GetMetadataReference() == id1, "set failed"); - try { - m2.SetMetadataReference(id1); - OSL_ENSURE(false, "set duplicate succeeded"); - } catch (lang::IllegalArgumentException) { } - m1.SetMetadataReference(id1); - OSL_ENSURE(m1.GetMetadataReference() == id1, "set failed (existing)"); - m1.EnsureMetadataReference(); - OSL_ENSURE(m1.GetMetadataReference() == id1, "ensure failed (existing)"); - - m2.EnsureMetadataReference(); - beans::StringPair m2id(m2.GetMetadataReference()); - OSL_ENSURE(m2id.Second.getLength(), "ensure failed"); - m2.EnsureMetadataReference(); - OSL_ENSURE(m2.GetMetadataReference() == m2id, "ensure failed (idempotent)"); - - m1.m_bInUndo = true; - OSL_ENSURE(!m1.GetMetadataReference().Second.getLength(), "move to undo failed"); - - m1.m_bInUndo = false; - OSL_ENSURE(m1.GetMetadataReference() == id1, "move from undo failed"); - - m1.m_bInUndo = true; - try { - m2.SetMetadataReference(id1); // steal! - } catch (lang::IllegalArgumentException &) { - OSL_ENSURE(false, "set duplicate to undo failed"); - } - m1.m_bInUndo = false; - OSL_ENSURE(!m1.GetMetadataReference().Second.getLength(), "move from undo: duplicate"); - - m3.RegisterAsCopyOf(m2); - OSL_ENSURE(m2.GetMetadataReference() == id1, "copy: source"); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "copy: duplicate"); - m4.RegisterAsCopyOf(m3); - OSL_ENSURE(m2.GetMetadataReference() == id1, "copy: source"); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "copy: duplicate"); - OSL_ENSURE(!m4.GetMetadataReference().Second.getLength(), "copy: duplicate"); - m2.m_bInUndo = true; - OSL_ENSURE(m3.GetMetadataReference() == id1, "duplicate to undo"); - OSL_ENSURE(!m2.GetMetadataReference().Second.getLength(), "duplicate to undo"); - m2.m_bInUndo = false; - OSL_ENSURE(m2.GetMetadataReference() == id1, "duplicate from undo"); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "duplicate from undo"); - - m4.EnsureMetadataReference(); // new! - beans::StringPair m4id(m4.GetMetadataReference()); - OSL_ENSURE(m4id.Second.getLength() && !(m4id == id1), "ensure on duplicate"); - - MockMetadatable mc1(true); // in clipboard - MockMetadatable mc2(true); - MockMetadatable mc3(true); - MockMetadatable mc4(true); - MockMetadatable m2p; - MockMetadatable m3p; - - mc1.SetMetadataReference(id2); - OSL_ENSURE(mc1.GetMetadataReference() == id2, "set failed"); - try { - mc2.SetMetadataReference(id2); - OSL_ENSURE(false, "set duplicate succeeded"); - } catch (lang::IllegalArgumentException) { } - mc1.SetMetadataReference(id2); - OSL_ENSURE(mc1.GetMetadataReference() == id2, "set failed (existing)"); - mc1.EnsureMetadataReference(); - OSL_ENSURE(mc1.GetMetadataReference() == id2, "ensure failed (existing)"); - mc2.EnsureMetadataReference(); - beans::StringPair mc2id(mc2.GetMetadataReference()); - OSL_ENSURE(mc2id.Second.getLength(), "ensure failed"); - mc2.EnsureMetadataReference(); - OSL_ENSURE(mc2.GetMetadataReference() == mc2id, "ensure failed (idempotent)"); - mc2.RemoveMetadataReference(); - OSL_ENSURE(!mc2.GetMetadataReference().Second.getLength(), "remove failed"); - - // set up mc2 as copy of m2 and mc3 as copy of m3 - mc3.RegisterAsCopyOf(m3); - OSL_ENSURE(!mc3.GetMetadataReference().Second.getLength() , "copy to clipboard (latent)"); - mc2.RegisterAsCopyOf(m2); - OSL_ENSURE(mc2.GetMetadataReference() == id1, "copy to clipboard (non-latent)"); - // paste mc2 to m2p and mc3 to m3p - m2p.RegisterAsCopyOf(mc2); - OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength() , "paste from clipboard (non-latent)"); - m3p.RegisterAsCopyOf(mc3); - OSL_ENSURE(!m3p.GetMetadataReference().Second.getLength() , "paste from clipboard (latent)"); - // delete m2, m2p, m3 - m2.RemoveMetadataReference(); - OSL_ENSURE(!m2.GetMetadataReference().Second.getLength(), "remove failed"); - OSL_ENSURE(m2p.GetMetadataReference() == id1, "paste-remove (non-latent)"); - m2p.RemoveMetadataReference(); - OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength(), "remove failed"); - OSL_ENSURE(m3.GetMetadataReference() == id1, "paste-remove2 (non-latent)"); - m3.RemoveMetadataReference(); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "remove failed"); - OSL_ENSURE(m3p.GetMetadataReference() == id1, "paste-remove (latent)"); - // delete mc2 - mc2.SetMetadataReference(beans::StringPair()); - OSL_ENSURE(!mc3.GetMetadataReference().Second.getLength() , "in clipboard becomes non-latent"); - // paste mc2 - m2p.RegisterAsCopyOf(mc2); - OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength(), "remove-paste"); - OSL_ENSURE(m3p.GetMetadataReference() == id1, "remove-paste (stolen)"); - - // auto-detect stream - m5.SetMetadataReference(id3e); - OSL_ENSURE(m5.GetMetadataReference() == id3, "auto-detect (content)"); - m5.m_bInContent = false; - m5.SetMetadataReference(id4e); - OSL_ENSURE(m5.GetMetadataReference() == id4, "auto-detect (styles)"); - - OSL_TRACE("sfx2::Metadatable test(): finished\n"); -} - -struct Test { Test() { test(); } }; -static Test s_test; - - #include <stdio.h> static void dump(sfx2::XmlIdList_t * pList) diff --git a/sfx2/source/menu/makefile.mk b/sfx2/source/menu/makefile.mk index d3b209fc4a45..8b55bd0840ea 100644 --- a/sfx2/source/menu/makefile.mk +++ b/sfx2/source/menu/makefile.mk @@ -43,10 +43,11 @@ SRS1NAME=$(TARGET) SRC1FILES = menu.src SLOFILES = \ + $(SLO)$/mnuitem.obj \ $(SLO)$/mnumgr.obj \ - $(SLO)$/virtmenu.obj \ $(SLO)$/objmnctl.obj \ - $(SLO)$/mnuitem.obj + $(SLO)$/thessubmenu.obj \ + $(SLO)$/virtmenu.obj # --- Tagets ------------------------------------------------------- diff --git a/sfx2/source/menu/menu.hrc b/sfx2/source/menu/menu.hrc index 5017f980872b..b437f797c26e 100644 --- a/sfx2/source/menu/menu.hrc +++ b/sfx2/source/menu/menu.hrc @@ -64,6 +64,10 @@ #define STR_MENU_ADDONS RID_SFX_MENU_START+2 #define STR_MENU_ADDONHELP RID_SFX_MENU_START+3 +#define STR_MENU_SYNONYMS (RID_SFX_MENU_START+11) +#define STR_MENU_NO_SYNONYM_FOUND (RID_SFX_MENU_START+12) +#define STR_MENU_THESAURUS (RID_SFX_MENU_START+13) + #define MN_CLIPBOARDFUNCS RID_SFX_MENU_START+1 #endif diff --git a/sfx2/source/menu/menu.src b/sfx2/source/menu/menu.src index 97c9c7f640fa..a2e07a3348b0 100644 --- a/sfx2/source/menu/menu.src +++ b/sfx2/source/menu/menu.src @@ -72,6 +72,21 @@ String STR_MENU_ADDONHELP Text [ en-US ] = "Add-~On Help" ; }; +String STR_MENU_SYNONYMS +{ + Text [ en-US ] = "Synonyms" ; +}; + +String STR_MENU_NO_SYNONYM_FOUND +{ + Text [ en-US ] = "(none)" ; +}; + +String STR_MENU_THESAURUS +{ + Text [ en-US ] = "~Thesaurus..." ; +}; + // ******************************************************************* EOF diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index ec803718f457..b264a5b47861 100644..100755 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -27,8 +27,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" + #include <com/sun/star/embed/VerbDescriptor.hpp> #include <com/sun/star/embed/VerbAttributes.hpp> +#include <com/sun/star/container/XNamed.hpp> #ifdef SOLARIS // HACK: prevent conflict between STLPORT and Workshop headers on Solaris 8 @@ -50,9 +52,14 @@ #include <framework/addonmenu.hxx> #include <comphelper/processfactory.hxx> #include <unotools/ucbstreamhelper.hxx> +#include <unotools/lingucfg.hxx> #include <tools/urlobj.hxx> #include <unotools/pathoptions.hxx> +#include <svl/stritem.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <osl/file.hxx> +#include <vcl/graph.hxx> +#include <svtools/filter.hxx> #include <sfx2/mnumgr.hxx> @@ -76,10 +83,15 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/objface.hxx> +#include "thessubmenu.hxx" + static const USHORT nCompatVersion = 4; static const USHORT nVersion = 5; +// static member initialization +PopupMenu * SfxPopupMenuManager::pStaticThesSubMenu = NULL; + using namespace com::sun::star; //========================================================================= @@ -166,6 +178,101 @@ void InsertVerbs_Impl( SfxBindings* pBindings, const com::sun::star::uno::Sequen } +//-------------------------------------------------------------------- + + +static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl ) +{ + Image aRes; + + ::rtl::OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} + + +PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) +{ + // + // build thesaurus sub menu if look-up string is available + // + PopupMenu* pThesSubMenu = 0; + SfxPoolItem *pItem = 0; + pBindings->QueryState( SID_THES, pItem ); + String aThesLookUpStr; + SfxStringItem *pStrItem = dynamic_cast< SfxStringItem * >(pItem); + xub_StrLen nDelimPos = STRING_LEN; + if (pStrItem) + { + aThesLookUpStr = pStrItem->GetValue(); + nDelimPos = aThesLookUpStr.SearchBackward( '#' ); + } + if (aThesLookUpStr.Len() > 0 && nDelimPos != STRING_NOTFOUND) + { + // get synonym list for sub menu + std::vector< ::rtl::OUString > aSynonyms; + SfxThesSubMenuHelper aHelper; + ::rtl::OUString aText( aHelper.GetText( aThesLookUpStr, nDelimPos ) ); + lang::Locale aLocale; + aHelper.GetLocale( aLocale, aThesLookUpStr, nDelimPos ); + const bool bHasMoreSynonyms = aHelper.GetMeanings( aSynonyms, aText, aLocale, 7 /*max number of synonyms to retrieve*/ ); + (void) bHasMoreSynonyms; + + pThesSubMenu = new PopupMenu; + pThesSubMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); + const size_t nNumSynonyms = aSynonyms.size(); + if (nNumSynonyms > 0) + { + SvtLinguConfig aCfg; + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + + Image aImage; + String sThesImplName( aHelper.GetThesImplName( aLocale ) ); + ::rtl::OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( sThesImplName, bHC ) ); + if (sThesImplName.Len() > 0 && aSynonymsImageUrl.getLength() > 0) + aImage = Image( lcl_GetImageFromPngUrl( aSynonymsImageUrl ) ); + + for (USHORT i = 0; (size_t)i < nNumSynonyms; ++i) + { + //! item ids should start with values > 0, since 0 has special meaning + const USHORT nId = i + 1; + + String aItemText( GetThesaurusReplaceText_Impl( aSynonyms[i] ) ); + pThesSubMenu->InsertItem( nId, aItemText ); + ::rtl::OUString aCmd( ::rtl::OUString::createFromAscii( ".uno:ThesaurusFromContext?WordReplace:string=" ) ); + aCmd += aItemText; + pThesSubMenu->SetItemCommand( nId, aCmd ); + + if (aSynonymsImageUrl.getLength() > 0) + pThesSubMenu->SetItemImage( nId, aImage ); + } + } + else // nNumSynonyms == 0 + { + const String aItemText( SfxResId( STR_MENU_NO_SYNONYM_FOUND ) ); + pThesSubMenu->InsertItem( 1, aItemText, MIB_NOSELECT ); + } + pThesSubMenu->InsertSeparator(); + const String sThesaurus( SfxResId( STR_MENU_THESAURUS ) ); + pThesSubMenu->InsertItem( 100, sThesaurus ); + pThesSubMenu->SetItemCommand( 100, ::rtl::OUString::createFromAscii( ".uno:ThesaurusDialog" ) ); + + pSVMenu->InsertSeparator(); + const String sSynonyms( SfxResId( STR_MENU_SYNONYMS ) ); + pSVMenu->InsertItem( SID_THES, sSynonyms ); + pSVMenu->SetPopupMenu( SID_THES, pThesSubMenu ); + } + + return pThesSubMenu; +} + //-------------------------------------------------------------------- @@ -305,7 +412,9 @@ void SfxPopupMenuManager::RemoveDisabledEntries() USHORT SfxPopupMenuManager::Execute( const Point& rPos, Window* pWindow ) { DBG_MEMTEST(); - return ( (PopupMenu*) GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); + USHORT nVal = ( (PopupMenu*) GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); + delete pStaticThesSubMenu; pStaticThesSubMenu = NULL; + return nVal; } //-------------------------------------------------------------------- @@ -429,6 +538,10 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra break; } + PopupMenu* pThesSubMenu = InsertThesaurusSubmenu_Impl( &pFrame->GetBindings(), pSVMenu ); + // #i107205# (see comment in header file) + pStaticThesSubMenu = pThesSubMenu; + if ( n == nCount ) { PopupMenu aPop( SfxResId( MN_CLIPBOARDFUNCS ) ); @@ -461,6 +574,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra aMgr->RemoveDisabledEntries(); return aMgr; } + return 0; } @@ -475,6 +589,8 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram break; } + PopupMenu* pThesSubMenu = InsertThesaurusSubmenu_Impl( &pFrame->GetBindings(), pSVMenu ); + if ( n == nCount ) { PopupMenu aPop( SfxResId( MN_CLIPBOARDFUNCS ) ); @@ -507,6 +623,8 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram aPop.RemoveDisabledEntries(); aPop.Execute( rPoint, pWindow ); } + + delete pThesSubMenu; } Menu* SfxPopupMenuManager::GetSVMenu() diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx new file mode 100755 index 000000000000..de1137bd6a74 --- /dev/null +++ b/sfx2/source/menu/thessubmenu.cxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: thessubmenu.cxx,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> + +#include <comphelper/processfactory.hxx> +#include <svl/stritem.hxx> +#include <tools/debug.hxx> +#include <vcl/graph.hxx> +#include <svtools/filter.hxx> + + +#include <vector> + +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/viewsh.hxx> +#include "thessubmenu.hxx" + + +using namespace ::com::sun::star; +using ::rtl::OUString; + + +// STATIC DATA ----------------------------------------------------------- + +SFX_IMPL_MENU_CONTROL(SfxThesSubMenuControl, SfxStringItem); + +//////////////////////////////////////////////////////////// + +String GetThesaurusReplaceText_Impl( const ::rtl::OUString &rText ) +{ + // The strings returned by the thesaurus sometimes have some + // explanation text put in between '(' and ')' or a trailing '*'. + // These parts should not be put in the ReplaceEdit Text that may get + // inserted into the document. Thus we strip them from the text. + + String aText( rText ); + + xub_StrLen nPos = aText.Search( sal_Unicode('(') ); + while (STRING_NOTFOUND != nPos) + { + xub_StrLen nEnd = aText.Search( sal_Unicode(')'), nPos ); + if (STRING_NOTFOUND != nEnd) + aText.Erase( nPos, nEnd-nPos+1 ); + else + break; + nPos = aText.Search( sal_Unicode('(') ); + } + + nPos = aText.Search( sal_Unicode('*') ); + if (STRING_NOTFOUND != nPos) + aText.Erase( nPos ); + + // remove any possible remaining ' ' that may confuse the thesaurus + // when it gets called with the text + aText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); + + return aText; +} + +//////////////////////////////////////////////////////////// + + +/* + Ctor; setzt Select-Handler am Menu und traegt Menu + in seinen Parent ein. + */ +SfxThesSubMenuControl::SfxThesSubMenuControl( USHORT nSlotId, Menu &rMenu, SfxBindings &rBindings ) + : SfxMenuControl( nSlotId, rBindings ), + pMenu(new PopupMenu), + rParent(rMenu) +{ + rMenu.SetPopupMenu(nSlotId, pMenu); + pMenu->SetSelectHdl(LINK(this, SfxThesSubMenuControl, MenuSelect)); + pMenu->Clear(); + rParent.EnableItem( GetId(), FALSE ); +} + + +SfxThesSubMenuControl::~SfxThesSubMenuControl() +{ + delete pMenu; +} + + +/* + Statusbenachrichtigung; + Ist die Funktionalit"at disabled, wird der entsprechende + Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. + */ +void SfxThesSubMenuControl::StateChanged( + USHORT /*nSID*/, + SfxItemState eState, + const SfxPoolItem* /*pState*/ ) +{ + rParent.EnableItem(GetId(), SFX_ITEM_AVAILABLE == eState ); +} + + +/* + Select-Handler des Menus; + das selektierte Verb mit ausgef"uhrt, + */ +IMPL_LINK_INLINE_START( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) +{ + const USHORT nSlotId = pSelMenu->GetCurItemId(); + if( nSlotId ) + GetBindings().Execute(nSlotId); + return 1; +} +IMPL_LINK_INLINE_END( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) + + +PopupMenu* SfxThesSubMenuControl::GetPopup() const +{ + return pMenu; +} + + +//////////////////////////////////////////////////////////// + +OUString SfxThesSubMenuHelper::GetText( + const String &rLookUpString, + xub_StrLen nDelimPos ) +{ + return OUString( rLookUpString.Copy( 0, nDelimPos ) ); +} + + +void SfxThesSubMenuHelper::GetLocale( + lang::Locale /*out */ &rLocale, + const String &rLookUpString, + xub_StrLen nDelimPos ) +{ + String aIsoLang( rLookUpString.Copy( nDelimPos + 1) ); + const xub_StrLen nPos = aIsoLang.Search( '-' ); + if (nPos != STRING_NOTFOUND) + { + rLocale.Language = aIsoLang.Copy( 0, nPos ); + rLocale.Country = aIsoLang.Copy( nPos + 1 ); + rLocale.Variant = String::EmptyString(); + } +} + + +SfxThesSubMenuHelper::SfxThesSubMenuHelper() +{ + try + { + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + m_xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); + m_xThesarus = m_xLngMgr->getThesaurus(); + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); + } +} + + +SfxThesSubMenuHelper::~SfxThesSubMenuHelper() +{ +} + + +bool SfxThesSubMenuHelper::IsSupportedLocale( const lang::Locale & rLocale ) const +{ + return m_xThesarus.is() && m_xThesarus->hasLocale( rLocale ); +} + + +bool SfxThesSubMenuHelper::GetMeanings( + std::vector< OUString > & rSynonyms, + const OUString & rWord, + const lang::Locale & rLocale, + sal_Int16 nMaxSynonms ) +{ + bool bHasMoreSynonyms = false; + rSynonyms.clear(); + if (IsSupportedLocale( rLocale ) && rWord.getLength() && nMaxSynonms > 0) + { + try + { + // get all meannings + const uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeaningSeq( + m_xThesarus->queryMeanings( rWord, rLocale, uno::Sequence< beans::PropertyValue >() )); + const uno::Reference< linguistic2::XMeaning > *pxMeaning = aMeaningSeq.getConstArray(); + const sal_Int32 nMeanings = aMeaningSeq.getLength(); + + // iterate over all meanings until nMaxSynonms are found or all meanings are processed + sal_Int32 nCount = 0; + sal_Int32 i = 0; + for ( ; i < nMeanings && nCount < nMaxSynonms; ++i) + { + const uno::Sequence< OUString > aSynonymSeq( pxMeaning[i]->querySynonyms() ); + const OUString *pSynonyms = aSynonymSeq.getConstArray(); + const sal_Int32 nSynonyms = aSynonymSeq.getLength(); + sal_Int32 k = 0; + for ( ; k < nSynonyms && nCount < nMaxSynonms; ++k) + { + rSynonyms.push_back( pSynonyms[k] ); + ++nCount; + } + bHasMoreSynonyms = k < nSynonyms; // any synonym from this meaning skipped? + } + + bHasMoreSynonyms |= i < nMeanings; // any meaning skipped? + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get synonyms" ); + } + } + return bHasMoreSynonyms; +} + + +String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) const +{ + String aRes; + DBG_ASSERT( m_xLngMgr.is(), "LinguServiceManager missing" ); + if (m_xLngMgr.is()) + { + uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( + OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; + } + return aRes; +} + +//////////////////////////////////////////////////////////// + + diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx new file mode 100644 index 000000000000..14d7473cb7c0 --- /dev/null +++ b/sfx2/source/menu/thessubmenu.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: thessubmenu.hxx,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _THESSUBMENU_HXX_ +#define _THESSUBMENU_HXX_ + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> + +#include <vcl/menu.hxx> +#include <sfx2/mnuitem.hxx> + +class SfxBindings; +class PopupMenu; +class Menu; + +namespace css = ::com::sun::star; + +//////////////////////////////////////////////////////////// + +String GetThesaurusReplaceText_Impl( const ::rtl::OUString &rText ); + +//////////////////////////////////////////////////////////// + +class SfxThesSubMenuControl : public SfxMenuControl +{ + PopupMenu* pMenu; + Menu& rParent; + +private: + virtual void StateChanged( USHORT, SfxItemState, const SfxPoolItem* pState ); + DECL_LINK( MenuSelect, Menu * ); + +public: + SfxThesSubMenuControl(USHORT, Menu&, SfxBindings&); + ~SfxThesSubMenuControl(); + + virtual PopupMenu* GetPopup() const; + + SFX_DECL_MENU_CONTROL(); +}; + +//////////////////////////////////////////////////////////// + +class SfxThesSubMenuHelper +{ + css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLngMgr; + css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; + +private: + + // don't use copy c-tor and assignment operator + SfxThesSubMenuHelper( const SfxThesSubMenuHelper & ); + SfxThesSubMenuHelper & operator = ( const SfxThesSubMenuHelper & ); + +public: + SfxThesSubMenuHelper(); + ~SfxThesSubMenuHelper(); + + static ::rtl::OUString GetText( const String &rLookUpString, xub_StrLen nDelimPos ); + + // returns the Locale to be used for the selected text when the thesaurus is to be called + static void GetLocale( css::lang::Locale /*out */ &rLocale, const String &rLookUpString, xub_StrLen nDelimPos ); + + // returns true if the locale is upported by the theasaurus + bool IsSupportedLocale( const css::lang::Locale & rLocale ) const; + + // get the first nMax Synonym entries, even if different meanings need to be evaluated + bool GetMeanings( std::vector< ::rtl::OUString > & rSynonyms, const ::rtl::OUString & rWord, const css::lang::Locale & rLocale, sal_Int16 nMaxSynonms ); + + String GetThesImplName( const css::lang::Locale &rLocale ) const; +}; + +//////////////////////////////////////////////////////////// + + +#endif + + diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 5e26b604ad41..231857195f37 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -531,6 +531,7 @@ BEGIN $wrapcmd = ""; if ( $plat =~ /linux/i ) { $islinux = 1; } + if ( $plat =~ /kfreebsd/i ) { $islinux = 1; } if ( $plat =~ /solaris/i ) { $issolaris = 1; } if ( $plat =~ /darwin/i ) { $ismacosx = 1; } diff --git a/solenv/bin/modules/pre2par/globals.pm b/solenv/bin/modules/pre2par/globals.pm index 55da94a211d2..a0a50dc11958 100644 --- a/solenv/bin/modules/pre2par/globals.pm +++ b/solenv/bin/modules/pre2par/globals.pm @@ -60,6 +60,7 @@ BEGIN $issolaris = 0; if ( $plat =~ /linux/i ) { $islinux = 1; } + if ( $plat =~ /kfreebsd/i ) { $islinux = 1; } if ( $plat =~ /solaris/i ) { $issolaris = 1; } } diff --git a/solenv/config/sdev300.ini b/solenv/config/sdev300.ini index 59fb8c263d16..56fe6c6e4a4d 100644 --- a/solenv/config/sdev300.ini +++ b/solenv/config/sdev300.ini @@ -2892,7 +2892,7 @@ wntmsci12 NSIS_PATH %SOL_TMP%$/r$/NSIS_242_unicode PCLEAN_PATH %SOLARROOT%$/etw PERL %SOL_TMP%$/r$/%PERLDIR% - PSDK %SOL_TMP%$/r$/msvc9p$/PlatformSDK$/V6.1 + PSDK %SOL_TMP%$/r$/msvc9p$/PlatformSDK$/v6.1 SHARED_COM_SDK_PATH %SOL_TMP%$/r$/msvc9p$/Common7$/IDE SOLARENV %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv SOLARROOT %SOL_TMP%$/r @@ -2915,7 +2915,7 @@ wntmsci12 NSIS_PATH %SOL_TMP%$/r$/NSIS_242_unicode PCLEAN_PATH %SOL_TMP%$/r$/etw PERL %SOL_TMP%$/r$/%PERLDIR% - PSDK %COMPATH%$/PlatformSDK$/V6.1 + PSDK %COMPATH%$/PlatformSDK$/v6.1 SHARED_COM_SDK_PATH %COMPATH%$/Common7$/IDE SOLARENV %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv SOLARROOT %SOL_TMP%$/r @@ -2990,7 +2990,7 @@ wntmsci12 NSIS_PATH %SOLAR_ENV_ROOT%$/NSIS_242_unicode PERL %SOLAR_ENV_ROOT%$/%PERLDIR% PKGFORMAT msi - PSDK %SOLAR_ENV_ROOT%$/msvc9p$/PlatformSDK$/V6.1 + PSDK %SOLAR_ENV_ROOT%$/msvc9p$/PlatformSDK$/v6.1 SHARED_COM_SDK_PATH %SOLAR_ENV_ROOT%$/msvc9p$/Common7$/ide SHARED_SOLARENV %SOLAR_SOURCE_ROOT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv SHARED_SOLARVERSION %SOLAR_SOURCE_ROOT%$/%WORK_STAMP% @@ -3234,7 +3234,7 @@ wntmsci13 NSIS_PATH %SOL_TMP%$/r$/NSIS_242_unicode PCLEAN_PATH %SOLARROOT%$/etw PERL %SOL_TMP%$/r$/%PERLDIR% - PSDK %SOL_TMP%$/r$/msvc9p$/PlatformSDK$/V6.1 + PSDK %SOL_TMP%$/r$/msvc9p$/PlatformSDK$/v6.1 SHARED_COM_SDK_PATH %SOL_TMP%$/r$/msvc9p$/Common7$/IDE SOLARENV %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv SOLARROOT %SOL_TMP%$/r @@ -3257,7 +3257,7 @@ wntmsci13 NSIS_PATH %SOL_TMP%$/r$/NSIS_242_unicode PCLEAN_PATH %SOL_TMP%$/r$/etw PERL %SOL_TMP%$/r$/%PERLDIR% - PSDK %COMPATH%$/PlatformSDK$/V6.1 + PSDK %COMPATH%$/PlatformSDK$/v6.1 SHARED_COM_SDK_PATH %COMPATH%$/Common7$/IDE SOLARENV %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv SOLARROOT %SOL_TMP%$/r @@ -3332,7 +3332,7 @@ wntmsci13 NSIS_PATH %SOLAR_ENV_ROOT%$/NSIS_242_unicode PERL %SOLAR_ENV_ROOT%$/%PERLDIR% PKGFORMAT msi - PSDK %SOLAR_ENV_ROOT%$/msvc9p$/PlatformSDK$/V6.1 + PSDK %SOLAR_ENV_ROOT%$/msvc9p$/PlatformSDK$/v6.1 SHARED_COM_SDK_PATH %SOLAR_ENV_ROOT%$/msvc9p$/Common7$/ide SHARED_SOLARENV %SOLAR_SOURCE_ROOT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv SHARED_SOLARVERSION %SOLAR_SOURCE_ROOT%$/%WORK_STAMP% diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 15a331cd8600..4c69817791e8 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=300 -RSCREVISION=300m81(Build:9509) -BUILD=9509 -LAST_MINOR=m81 +RSCREVISION=300m82(Build:9510) +BUILD=9510 +LAST_MINOR=m82 SOURCEVERSION=DEV300 diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index b019a5b08ee1..75aee6fd2009 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -300,7 +300,7 @@ public: class SmShowSymbolSet : public Control { - SmSymSet aSymbolSet; + SymbolPtrVec_t aSymbolSet; ScrollBar aVScrollBar; Size aOutputSize; Link aSelectHdlLink; @@ -318,7 +318,7 @@ class SmShowSymbolSet : public Control public: SmShowSymbolSet(Window *pParent, const ResId& rResId); - void SetSymbolSet(const SmSymSet& rSymbolSet); + void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet); void SelectSymbol(USHORT nSymbol); USHORT GetSelectSymbol() const { return nSelectSymbol; } @@ -360,8 +360,10 @@ class SmSymbolDialog : public ModalDialog PushButton aEditBtn; SmViewShell &rViewSh; - SmSymSetManager &rSymSetMgr; - const SmSymSet *pSymSet; + SmSymbolManager &rSymbolMgr; + + String aSymbolSetName; + SymbolPtrVec_t aSymbolSet; OutputDevice *pFontListDev; @@ -373,7 +375,7 @@ class SmSymbolDialog : public ModalDialog DECL_LINK(GetClickHdl, Button *); void FillSymbolSets(BOOL bDeleteText = TRUE); - void SetSymbolSetManager(SmSymSetManager &rMgr); + void SetSymbolSetManager(SmSymbolManager &rMgr); const SmSym *GetSymbol() const; void InitColor_Impl(); @@ -381,7 +383,7 @@ class SmSymbolDialog : public ModalDialog public: SmSymbolDialog(Window * pParent, OutputDevice *pFntListDevice, - SmSymSetManager &rSymSetMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE); + SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE); virtual ~SmSymbolDialog(); BOOL SelectSymbolSet(const XubString &rSymbolSetName); @@ -439,8 +441,8 @@ class SmSymDefineDialog : public ModalDialog Image aRigthArrow_Im; Image aRigthArrow_Im_HC; // hi-contrast version - SmSymSetManager aSymSetMgrCopy, - &rSymSetMgr; + SmSymbolManager aSymbolMgrCopy, + &rSymbolMgr; const SmSym *pOrigSymbol; const SubsetMap *pSubsetMap; @@ -462,7 +464,7 @@ class SmSymDefineDialog : public ModalDialog void FillFonts(BOOL bDeleteText = TRUE); void FillStyles(BOOL bDeleteText = TRUE); - void SetSymbolSetManager(const SmSymSetManager &rMgr); + void SetSymbolSetManager(const SmSymbolManager &rMgr); void SetFont(const XubString &rFontName, const XubString &rStyleName); void SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName); void UpdateButtons(); @@ -474,18 +476,18 @@ class SmSymDefineDialog : public ModalDialog BOOL SelectFont(const XubString &rFontName, BOOL bApplyFont); BOOL SelectStyle(const XubString &rStyleName, BOOL bApplyFont); - - SmSymSet *GetSymbolSet(const ComboBox &rComboBox); - inline const SmSymSet *GetSymbolSet(const ComboBox &rComboBox) const; - SmSym *GetSymbol(const ComboBox &rComboBox); - inline const SmSym *GetSymbol(const ComboBox &rComboBox) const; + SmSym * GetSymbol(const ComboBox &rComboBox); + const SmSym * GetSymbol(const ComboBox &rComboBox) const + { + return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox); + } void InitColor_Impl(); virtual void DataChanged( const DataChangedEvent& rDCEvt ); public: - SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymSetManager &rMgr, BOOL bFreeRes = TRUE); + SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr, BOOL bFreeRes = TRUE); ~SmSymDefineDialog(); using OutputDevice::SetFont; @@ -493,44 +495,31 @@ public: // Dialog virtual short Execute(); - inline BOOL SelectOldSymbolSet(const XubString &rSymbolSetName); - inline BOOL SelectOldSymbol(const XubString &rSymbolName); - inline BOOL SelectSymbolSet(const XubString &rSymbolSetName); - inline BOOL SelectSymbol(const XubString &rSymbolName); - BOOL SelectFont(const XubString &rFontName) { return SelectFont(rFontName, TRUE); } - BOOL SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); }; - void SelectChar(xub_Unicode cChar); -}; - -inline const SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox) const -{ - return ((SmSymDefineDialog *) this)->GetSymbolSet(rComboBox); -} + BOOL SelectOldSymbolSet(const XubString &rSymbolSetName) + { + return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE); + } -inline const SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) const -{ - return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox); -} + BOOL SelectOldSymbol(const XubString &rSymbolName) + { + return SelectSymbol(aOldSymbols, rSymbolName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectOldSymbolSet(const XubString &rSymbolSetName) -{ - return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE); -} + BOOL SelectSymbolSet(const XubString &rSymbolSetName) + { + return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectOldSymbol(const XubString &rSymbolName) -{ - return SelectSymbol(aOldSymbols, rSymbolName, FALSE); -} + BOOL SelectSymbol(const XubString &rSymbolName) + { + return SelectSymbol(aSymbols, rSymbolName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectSymbolSet(const XubString &rSymbolSetName) -{ - return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE); -} + BOOL SelectFont(const XubString &rFontName) { return SelectFont(rFontName, TRUE); } + BOOL SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); }; + void SelectChar(xub_Unicode cChar); +}; -inline BOOL SmSymDefineDialog::SelectSymbol(const XubString &rSymbolName) -{ - return SelectSymbol(aSymbols, rSymbolName, FALSE); -} #endif diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index bd8292e9a7b1..f74beb9de92b 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -47,7 +47,7 @@ class SvxErrorHandler; class SfxObjectFactory; class SmConfig; class SmModule; -class SmSymSetManager; +class SmSymbolManager; /************************************************************************* |* @@ -149,7 +149,7 @@ public: svtools::ColorConfig & GetColorConfig(); SmConfig * GetConfig(); - SmSymSetManager & GetSymSetManager(); + SmSymbolManager & GetSymbolManager(); SmLocalizedSymbolData & GetLocSymbolData() const; @@ -176,7 +176,6 @@ public: }; #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) ) -#define SM_MOD1() ( *(SmModule**) GetAppData(SHL_SM) ) #endif // _SDMOD_HXX diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 8c8df60c2c6e..503859485095 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -28,198 +28,146 @@ #define SYMBOL_HXX #include <vos/refernce.hxx> -#ifndef _FONT_HXX //autogen #include <vcl/font.hxx> -#endif #include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/dynary.hxx> #include <svl/lstner.hxx> #include <svl/svarray.hxx> + +#include <map> +#include <vector> +#include <set> + #include "utility.hxx" -#include <smmod.hxx> +#include "smmod.hxx" -#define SS_ATTR_ACCESS 0x80 #define SYMBOLSET_NONE 0xFFFF #define SYMBOL_NONE 0xFFFF -class SmSymSetManager; //////////////////////////////////////////////////////////////////////////////// inline const String GetExportSymbolName( const String &rUiSymbolName ) { - return SM_MOD1()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); + return SM_MOD()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); } inline const String GetUiSymbolName( const String &rExportSymbolName ) { - return SM_MOD1()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); + return SM_MOD()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); } inline const String GetExportSymbolSetName( const String &rUiSymbolSetName ) { - return SM_MOD1()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); + return SM_MOD()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); } inline const String GetUiSymbolSetName( const String &rExportSymbolSetName ) { - return SM_MOD1()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); + return SM_MOD()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); } //////////////////////////////////////////////////////////////////////////////// class SmSym { - friend class SmSymSetManager; - - SmFace Face; - String Name; - String aExportName; - String aSetName; - SmSym *pHashNext; - SmSymSetManager *pSymSetManager; - sal_Unicode Character; - BYTE Attribut; - BOOL bPredefined; - BOOL bDocSymbol; + SmFace m_aFace; + String m_aName; + String m_aExportName; + String m_aSetName; + sal_Unicode m_cChar; + BOOL m_bPredefined; + BOOL m_bDocSymbol; public: SmSym(); - SmSym(const SmSym& rSymbol); SmSym(const String& rName, const Font& rFont, sal_Unicode cChar, const String& rSet, BOOL bIsPredefined = FALSE); + SmSym(const SmSym& rSymbol); SmSym& operator = (const SmSym& rSymbol); - const Font& GetFace() const { return Face; } - sal_Unicode GetCharacter() const { return Character; } - const String& GetName() const { return Name; } + const Font& GetFace() const { return m_aFace; } + sal_Unicode GetCharacter() const { return m_cChar; } + const String& GetName() const { return m_aName; } - void SetFace( const Font& rFont ) { Face = rFont; } - void SetCharacter( sal_Unicode cChar ) { Character = cChar; } - void SetName( const String &rTxt ) { Name = rTxt; } + void SetFace( const Font& rFont ) { m_aFace = rFont; } + void SetCharacter( sal_Unicode cChar ) { m_cChar = cChar; } - BOOL IsPredefined() const { return bPredefined; } - const String & GetSetName() const { return aSetName; } - void SetSetName( const String &rName ) { aSetName = rName; } - const String & GetExportName() const { return aExportName; } - void SetExportName( const String &rName ) { aExportName = rName; } +//! since the symbol name is also used as key in the map it should not be possible to change the name +//! because ten the key would not be the same as its supposed copy here +// void SetName( const String &rTxt ) { m_aName = rTxt; } - BOOL IsDocSymbol() const { return bDocSymbol; } - void SetDocSymbol( BOOL bVal ) { bDocSymbol = bVal; } -}; + BOOL IsPredefined() const { return m_bPredefined; } + const String & GetSymbolSetName() const { return m_aSetName; } + void SetSymbolSetName( const String &rName ) { m_aSetName = rName; } + const String & GetExportName() const { return m_aExportName; } + void SetExportName( const String &rName ) { m_aExportName = rName; } + + BOOL IsDocSymbol() const { return m_bDocSymbol; } + void SetDocSymbol( BOOL bVal ) { m_bDocSymbol = bVal; } -DECLARE_LIST(SmListSym, SmSym *) -SV_DECL_PTRARR( SymbolArray, SmSym *, 32, 32 ) + // true if rSymbol has the same name, font and character + bool IsEqualInUI( const SmSym& rSymbol ) const; +}; /**************************************************************************/ -class SmSymSet +struct lt_String { - friend class SmSymSetManager; - - SmListSym SymbolList; - String Name; - SmSymSetManager *pSymSetManager; - -public: - SmSymSet(); - SmSymSet(const SmSymSet& rSymbolSet); - SmSymSet(const String& rName); - ~SmSymSet(); - - SmSymSet& operator = (const SmSymSet& rSymbolSet); - - const String& GetName() const { return Name; } - USHORT GetCount() const { return (USHORT) SymbolList.Count(); } - - const SmSym& GetSymbol(USHORT SymbolNo) const + bool operator()( const String &r1, const String &r2 ) const { - DBG_ASSERT(SymbolList.GetObject(SymbolNo), "Symbol nicht vorhanden"); - return *SymbolList.GetObject(SymbolNo); + // r1 < r2 ? + return r1.CompareTo( r2 ) == COMPARE_LESS; } - - USHORT AddSymbol(SmSym* pSymbol); - void DeleteSymbol(USHORT SymbolNo); - SmSym * RemoveSymbol(USHORT SymbolNo); - USHORT GetSymbolPos(const String& rName); }; -DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *) - -/**************************************************************************/ - -class SmSymbolDialog; - - -struct SmSymSetManager_Impl -{ - SmArraySymSet SymbolSets; - SmSymSetManager & rSymSetMgr; - SmSym** HashEntries; - USHORT NoSymbolSets; - USHORT NoHashEntries; - BOOL Modified; - - SmSymSetManager_Impl( SmSymSetManager &rMgr, USHORT HashTableSize ); - ~SmSymSetManager_Impl(); - SmSymSetManager_Impl & operator = ( const SmSymSetManager_Impl &rImpl ); -}; +// type of the actual container to hold the symbols +typedef std::map< String, SmSym, lt_String > SymbolMap_t; +// vector of pointers to the actual symbols in the above container +typedef std::vector< const SmSym * > SymbolPtrVec_t; -class SmSymSetManager : public SfxListener +class SmSymbolManager : public SfxListener { - friend struct SmSymSetManager_Impl; - - SmSymSetManager_Impl *pImpl; + SymbolMap_t m_aSymbols; + bool m_bModified; virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType); - UINT32 GetHashIndex(const String& rSymbolName); - void EnterHashTable(SmSym& rSymbol); - void EnterHashTable(SmSymSet& rSymbolSet); - void FillHashTable(); void Init(); void Exit(); public: - SmSymSetManager(USHORT HashTableSize = 137); - SmSymSetManager(const SmSymSetManager& rSymbolSetManager); - ~SmSymSetManager(); + SmSymbolManager(); + SmSymbolManager(const SmSymbolManager& rSymbolSetManager); + ~SmSymbolManager(); - SmSymSetManager& operator = (const SmSymSetManager& rSymbolSetManager); + SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager); - void GetSymbols( std::vector< SmSym > &rSymbols ) const; + // symbol sets are for UI purpose only, thus we assemble them here + std::set< String > GetSymbolSetNames() const; + const SymbolPtrVec_t GetSymbolSet( const String& rSymbolSetName ); - - USHORT AddSymbolSet(SmSymSet* pSymbolSet); - void ChangeSymbolSet(SmSymSet* pSymbolSet); - void DeleteSymbolSet(USHORT SymbolSetNo); - USHORT GetSymbolSetPos(const String& rSymbolSetName) const; - USHORT GetSymbolSetCount() const { return pImpl->NoSymbolSets; } - SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const - { - return pImpl->SymbolSets.Get(SymbolSetNo); - } + USHORT GetSymbolCount() const { return static_cast< USHORT >(m_aSymbols.size()); } + const SymbolPtrVec_t GetSymbols() const; + bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false ); + void RemoveSymbol( const String & rSymbolName ); SmSym * GetSymbolByName(const String& rSymbolName); const SmSym * GetSymbolByName(const String& rSymbolName) const { - return ((SmSymSetManager *) this)->GetSymbolByName(rSymbolName); + return ((SmSymbolManager *) this)->GetSymbolByName(rSymbolName); } - void AddReplaceSymbol( const SmSym & rSymbol ); - USHORT GetSymbolCount() const; - const SmSym * GetSymbolByPos( USHORT nPos ) const; - - BOOL IsModified() const { return pImpl->Modified; } - void SetModified(BOOL Modify) { pImpl->Modified = Modify; } + bool IsModified() const { return m_bModified; } + void SetModified(bool bModify) { m_bModified = bModify; } void Load(); void Save(); diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index da507871ed61..bf62157a30d3 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -429,7 +429,7 @@ SmMathConfig::SmMathConfig() : pFormat = 0; pOther = 0; pFontFormatList = 0; - pSymSetMgr = 0; + pSymbolMgr = 0; bIsOtherModified = bIsFormatModified = FALSE; } @@ -441,7 +441,7 @@ SmMathConfig::~SmMathConfig() delete pFormat; delete pOther; delete pFontFormatList; - delete pSymSetMgr; + delete pSymbolMgr; } @@ -554,14 +554,14 @@ void SmMathConfig::ReadSymbol( SmSym &rSymbol, } -SmSymSetManager & SmMathConfig::GetSymSetManager() +SmSymbolManager & SmMathConfig::GetSymbolManager() { - if (!pSymSetMgr) + if (!pSymbolMgr) { - pSymSetMgr = new SmSymSetManager; - pSymSetMgr->Load(); + pSymbolMgr = new SmSymbolManager; + pSymbolMgr->Load(); } - return *pSymSetMgr; + return *pSymbolMgr; } @@ -570,6 +570,7 @@ void SmMathConfig::Commit() Save(); } + void SmMathConfig::Save() { SaveOther(); @@ -577,6 +578,7 @@ void SmMathConfig::Save() SaveFontFormatList(); } + void SmMathConfig::GetSymbols( std::vector< SmSym > &rSymbols ) const { Sequence< OUString > aNodes( ((SmMathConfig*) this)->GetNodeNames( A2OU( SYMBOL_LIST ) ) ); @@ -627,7 +629,7 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols ) // Set pVal->Name = aNodeNameDelim; pVal->Name += *pName++; - OUString aTmp( rSymbol.GetSetName() ); + OUString aTmp( rSymbol.GetSymbolSetName() ); if (rSymbol.IsPredefined()) aTmp = GetExportSymbolSetName( aTmp ); pVal->Value <<= aTmp; diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx index 514573f6e7ac..9e4aa9f39f2f 100644 --- a/starmath/source/cfgitem.hxx +++ b/starmath/source/cfgitem.hxx @@ -122,7 +122,7 @@ class SmMathConfig : public utl::ConfigItem SmFormat * pFormat; SmCfgOther * pOther; SmFontFormatList * pFontFormatList; - SmSymSetManager * pSymSetMgr; + SmSymbolManager * pSymbolMgr; BOOL bIsOtherModified; BOOL bIsFormatModified; @@ -182,7 +182,7 @@ public: //using utl::ConfigItem::ReplaceSetProperties; //using utl::ConfigItem::GetReadOnlyStates; - SmSymSetManager & GetSymSetManager(); + SmSymbolManager & GetSymbolManager(); void GetSymbols( std::vector< SmSym > &rSymbols ) const; void SetSymbols( const std::vector< SmSym > &rNewSymbols ); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 257fdb959484..037f2fc1dff8 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -426,7 +426,7 @@ IMPL_LINK( SmFontSizeDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -533,7 +533,7 @@ IMPL_LINK_INLINE_START( SmFontTypeDialog, DefaultButtonClickHdl, Button *, EMPTY QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY)); if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt, TRUE ); @@ -579,7 +579,7 @@ SmFontTypeDialog::SmFontTypeDialog(Window * pParent, OutputDevice *pFntListDevic void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); aVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE); aFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION); @@ -601,7 +601,7 @@ void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat) void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = aVariableFont; pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = aFunctionFont; @@ -740,7 +740,7 @@ IMPL_LINK( SmDistanceDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -1063,7 +1063,7 @@ IMPL_LINK( SmAlignDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton*/ if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -1140,12 +1140,12 @@ void SmShowSymbolSet::Paint(const Rectangle&) SetMapMode(MapMode(MAP_PIXEL)); USHORT v = sal::static_int_cast< USHORT >((aVScrollBar.GetThumbPos() * nColumns)); - USHORT nSymbols = aSymbolSet.GetCount(); + size_t nSymbols = aSymbolSet.size(); Color aTxtColor( GetTextColor() ); for (USHORT i = v; i < nSymbols ; i++) { - SmSym aSymbol (aSymbolSet.GetSymbol(i)); + SmSym aSymbol (*aSymbolSet[i]); Font aFont (aSymbol.GetFace()); aFont.SetAlign(ALIGN_TOP); @@ -1206,7 +1206,7 @@ void SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt) case KEY_LEFT: n -= 1; break; case KEY_RIGHT: n += 1; break; case KEY_HOME: n = 0; break; - case KEY_END: n = aSymbolSet.GetCount() - 1; break; + case KEY_END: n = static_cast< USHORT >(aSymbolSet.size() - 1); break; case KEY_PAGEUP: n -= nColumns * nRows; break; case KEY_PAGEDOWN: n += nColumns * nRows; break; @@ -1218,7 +1218,7 @@ void SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt) else n = 0; - if (n >= aSymbolSet.GetCount()) + if (n >= aSymbolSet.size()) n = nSelectSymbol; // adjust scrollbar @@ -1274,13 +1274,13 @@ SmShowSymbolSet::SmShowSymbolSet(Window *pParent, const ResId& rResId) : } -void SmShowSymbolSet::SetSymbolSet(const SmSymSet& rSymbolSet) +void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolSet = rSymbolSet; - if (aSymbolSet.GetCount() > (nColumns * nRows)) + if (static_cast< USHORT >(aSymbolSet.size()) > (nColumns * nRows)) { - aVScrollBar.SetRange(Range(0, ((aSymbolSet.GetCount() + (nColumns - 1)) / nColumns) - nRows)); + aVScrollBar.SetRange(Range(0, ((aSymbolSet.size() + (nColumns - 1)) / nColumns) - nRows)); aVScrollBar.Enable(TRUE); } else @@ -1302,10 +1302,10 @@ void SmShowSymbolSet::SelectSymbol(USHORT nSymbol) ((nSelectSymbol - v) / nColumns) * nLen), Size(nLen, nLen))); - if (nSymbol < aSymbolSet.GetCount()) + if (nSymbol < aSymbolSet.size()) nSelectSymbol = nSymbol; - if (aSymbolSet.GetCount() == 0) + if (aSymbolSet.size() == 0) nSelectSymbol = SYMBOL_NONE; if (nSelectSymbol != SYMBOL_NONE) @@ -1380,9 +1380,10 @@ void SmSymbolDialog::FillSymbolSets(BOOL bDeleteText) if (bDeleteText) aSymbolSets.SetNoSelection(); - USHORT nNumSymSets = rSymSetMgr.GetSymbolSetCount(); - for (USHORT i = 0; i < nNumSymSets; i++) - aSymbolSets.InsertEntry(rSymSetMgr.GetSymbolSet(i)->GetName()); + std::set< String > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() ); + std::set< String >::const_iterator aIt( aSybolSetNames.begin() ); + for ( ; aIt != aSybolSetNames.end(); ++aIt) + aSymbolSets.InsertEntry( *aIt ); } @@ -1416,7 +1417,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) DBG_ASSERT(pButton == &aEditBtn, "Sm : falsches Argument"); #endif - SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymSetMgr); + SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr); // aktuelles Symbol und SymbolSet am neuen Dialog setzen const XubString aSymSetName (aSymbolSets.GetSelectEntry()), @@ -1432,9 +1433,9 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) USHORT nSymPos = GetSelectedSymbol(); // Dialog an evtl geaenderte Daten des SymbolSet Manager anpassen - if (pDialog->Execute() == RET_OK && rSymSetMgr.IsModified()) + if (pDialog->Execute() == RET_OK && rSymbolMgr.IsModified()) { - rSymSetMgr.Save(); + rSymbolMgr.Save(); FillSymbolSets(); } @@ -1442,7 +1443,16 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) // (soweit eines vorhanden ist) if (!SelectSymbolSet(aOldSymbolSet) && aSymbolSets.GetEntryCount() > 0) SelectSymbolSet(aSymbolSets.GetEntry(0)); + else + { + // just update display of current symbol set + DBG_ASSERT( aSymSetName == aSymSetName, "unexpected change in symbol set name" ); + aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName ); + aSymbolSetDisplay.SetSymbolSet( aSymbolSet ); + } + if (nSymPos >= aSymbolSet.size()) + nSymPos = static_cast< USHORT >(aSymbolSet.size()) - 1; SelectSymbol( nSymPos ); delete pDialog; @@ -1499,7 +1509,7 @@ IMPL_LINK_INLINE_END( SmSymbolDialog, CloseClickHdl, Button *, pButton ) SmSymbolDialog::SmSymbolDialog(Window *pParent, OutputDevice *pFntListDevice, - SmSymSetManager &rMgr, SmViewShell &rViewShell, BOOL bFreeRes) : + SmSymbolManager &rMgr, SmViewShell &rViewShell, BOOL bFreeRes) : ModalDialog (pParent, SmResId(RID_SYMBOLDIALOG)), aSymbolSetText (this, SmResId(1)), aSymbolSets (this, SmResId(1)), @@ -1510,13 +1520,14 @@ SmSymbolDialog::SmSymbolDialog(Window *pParent, OutputDevice *pFntListDevice, aCloseBtn (this, SmResId(3)), aEditBtn (this, SmResId(1)), rViewSh (rViewShell), - rSymSetMgr (rMgr), + rSymbolMgr (rMgr), pFontListDev (pFntListDevice) { if (bFreeRes) FreeResource(); - pSymSet = NULL; + aSymbolSetName = String(); + aSymbolSet.clear(); FillSymbolSets(); if (aSymbolSets.GetEntryCount() > 0) SelectSymbolSet(aSymbolSets.GetEntry(0)); @@ -1580,18 +1591,17 @@ BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName) BOOL bRet = FALSE; USHORT nPos = aSymbolSets.GetEntryPos(rSymbolSetName); - pSymSet = NULL; + aSymbolSetName = String(); + aSymbolSet.clear(); if (nPos != LISTBOX_ENTRY_NOTFOUND) { aSymbolSets.SelectEntryPos(nPos); - USHORT nSymbolSetNo = rSymSetMgr.GetSymbolSetPos(aSymbolSets.GetSelectEntry()); - pSymSet = rSymSetMgr.GetSymbolSet(nSymbolSetNo); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pSymSet, "Sm : NULL pointer"); -#endif - aSymbolSetDisplay.SetSymbolSet(*pSymSet); - if (pSymSet->GetCount() > 0) + aSymbolSetName = rSymbolSetName; + aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName ); + + aSymbolSetDisplay.SetSymbolSet( aSymbolSet ); + if (aSymbolSet.size() > 0) SelectSymbol(0); bRet = TRUE; @@ -1606,8 +1616,8 @@ BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName) void SmSymbolDialog::SelectSymbol(USHORT nSymbolNo) { const SmSym *pSym = NULL; - if (pSymSet && nSymbolNo < pSymSet->GetCount()) - pSym = &pSymSet->GetSymbol(nSymbolNo); + if (aSymbolSetName.Len() > 0 && nSymbolNo < static_cast< USHORT >(aSymbolSet.size())) + pSym = aSymbolSet[ nSymbolNo ]; aSymbolSetDisplay.SelectSymbol(nSymbolNo); aSymbolDisplay.SetSymbol(pSym); @@ -1618,7 +1628,8 @@ void SmSymbolDialog::SelectSymbol(USHORT nSymbolNo) const SmSym * SmSymbolDialog::GetSymbol() const { USHORT nSymbolNo = aSymbolSetDisplay.GetSelectSymbol(); - return pSymSet == NULL ? NULL : &pSymSet->GetSymbol(nSymbolNo); + bool bValid = aSymbolSetName.Len() > 0 && nSymbolNo < static_cast< USHORT >(aSymbolSet.size()); + return bValid ? aSymbolSet[ nSymbolNo ] : NULL; } @@ -1678,15 +1689,10 @@ void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, BOOL bDeleteText) if (bDeleteText) rComboBox.SetText(XubString()); - ComboBox &rSymbolSets = &rComboBox == &aOldSymbols ? - aOldSymbolSets : aSymbolSets; - const SmSymSet *pSymSet = GetSymbolSet(rSymbolSets); - if (pSymSet) - { USHORT nNumSymbols = pSymSet->GetCount(); - for (USHORT i = 0; i < nNumSymbols; i++) - rComboBox.InsertEntry(pSymSet->GetSymbol(i).GetName()); - } - + ComboBox &rBox = &rComboBox == &aOldSymbols ? aOldSymbolSets : aSymbolSets; + SymbolPtrVec_t aSymSet( aSymbolMgrCopy.GetSymbolSet( rBox.GetText() ) ); + for (size_t i = 0; i < aSymSet.size(); ++i) + rComboBox.InsertEntry( aSymSet[i]->GetName() ); } @@ -1701,9 +1707,10 @@ void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, BOOL bDeleteText) if (bDeleteText) rComboBox.SetText(XubString()); - USHORT nNumSymSets = aSymSetMgrCopy.GetSymbolSetCount(); - for (USHORT i = 0; i < nNumSymSets; i++) - rComboBox.InsertEntry(aSymSetMgrCopy.GetSymbolSet(i)->GetName()); + const std::set< String > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() ); + std::set< String >::const_iterator aIt( aSymbolSetNames.begin() ); + for ( ; aIt != aSymbolSetNames.end(); ++aIt) + rComboBox.InsertEntry( *aIt ); } @@ -1748,26 +1755,13 @@ void SmSymDefineDialog::FillStyles(BOOL bDeleteText) } -SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox) -{ -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, - "Sm : falsche ComboBox"); -#endif - USHORT nSymbolSetNo = aSymSetMgrCopy.GetSymbolSetPos(rComboBox.GetText()); - - return nSymbolSetNo == SYMBOLSET_NONE ? - NULL : aSymSetMgrCopy.GetSymbolSet(nSymbolSetNo); -} - - SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) { #if OSL_DEBUG_LEVEL > 1 DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, "Sm : falsche ComboBox"); #endif - return aSymSetMgrCopy.GetSymbolByName(rComboBox.GetText()); + return aSymbolMgrCopy.GetSymbolByName(rComboBox.GetText()); } @@ -1897,32 +1891,23 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, EMPTYARG pButton ) DBG_ASSERT(aAddBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); #endif - SmSymSet *pSymSet = GetSymbolSet(aSymbolSets); - - // SymbolSet einfuegen falls es noch nicht existiert - if (!pSymSet) - { - pSymSet = new SmSymSet(aSymbolSets.GetText()); - aSymSetMgrCopy.AddSymbolSet(pSymSet); - FillSymbolSets(aOldSymbolSets, FALSE); - FillSymbolSets(aSymbolSets, FALSE); - } -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pSymSet, "Sm : NULL pointer"); -#endif - - // Symbol ins SymbolSet einfuegen + // add symbol // TO_DO_UCS4 (#i74049): get rid of cast without loosing UCS4 functionality - SmSym *pSym = new SmSym(aSymbols.GetText(), aCharsetDisplay.GetFont(), - sal::static_int_cast< sal_Unicode >(aCharsetDisplay.GetSelectCharacter()), - aSymbolSets.GetText()); - pSymSet->AddSymbol(pSym); - - // update der Hash Tabelle erzwingen (damit aAddBtn disabled wird). - // (wird spaeter nach Ueberarbeitung von symbol.cxx ueberfluessig werden). - aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1); - - // Symbolliste aktualiseren + const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), + sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), + aSymbolSets.GetText() ); + //DBG_ASSERT( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" ); + aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol ); + + // update display of new symbol + aSymbolDisplay.SetChar( aNewSymbol.GetCharacter() ); + aSymbolDisplay.SetFont( aNewSymbol.GetFace() ); + aSymbolName.SetText( aNewSymbol.GetName() ); + aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() ); + + // update list box entries + FillSymbolSets(aOldSymbolSets, FALSE); + FillSymbolSets(aSymbolSets, FALSE); FillSymbols(aOldSymbols ,FALSE); FillSymbols(aSymbols ,FALSE); @@ -1940,61 +1925,36 @@ IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, EMPTYARG pButton ) DBG_ASSERT(aChangeBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); #endif - // finden des SymbolSets zum alten Symbol - SmSymSet *pOldSymSet = GetSymbolSet(aOldSymbolSets); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pOldSymSet, "Sm : NULL pointer"); -#endif - - // suchen des neuen SymbolSets - SmSymSet *pNewSymSet = GetSymbolSet(aSymbolSets); - // SymbolSet einfuegen falls es noch nicht existiert - if (!pNewSymSet) - { - pNewSymSet = new SmSymSet(aSymbolSets.GetText()); - aSymSetMgrCopy.AddSymbolSet(pNewSymSet); - FillSymbolSets(aOldSymbolSets, FALSE); - FillSymbolSets(aSymbolSets, FALSE); - } - - // das (alte) Symbol besorgen - USHORT nSymbol = pOldSymSet->GetSymbolPos(aOldSymbols.GetText()); - SmSym *pSym = (SmSym *) &pOldSymSet->GetSymbol(nSymbol); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( SYMBOL_NONE != nSymbol, "symbol not found" ); - DBG_ASSERT(pSym, "Sm : NULL pointer"); -#endif - - // apply changes - pSym->SetName( aSymbols.GetText() ); - //! get font from symbol-display since charset-display does not keep + // get new Sybol to use + //! get font from symbol-disp lay since charset-display does not keep //! the bold attribut. - pSym->SetFace( aSymbolDisplay.GetFont() ); // TO_DO_UCS4 (#i74049): get rid of cast without loosing UCS4 functionality - pSym->SetCharacter( sal::static_int_cast< sal_Unicode >(aCharsetDisplay.GetSelectCharacter()) ); - - // das SymbolSet wechseln wenn noetig - if (pOldSymSet != pNewSymSet) - { - pNewSymSet->AddSymbol( new SmSym( *pSym ) ); - pOldSymSet->DeleteSymbol(nSymbol); - - // - // update controls - // - // actualize symbol-lists in the dialog - String aTmpOldSymbolName( pOrigSymbol->GetName() ); - aOldSymbols.SetText( String() ); - aOldSymbols.RemoveEntry( aTmpOldSymbolName ); - if (aSymbolSets.GetText() == aOldSymbolSets.GetText()) - aSymbols.RemoveEntry( aTmpOldSymbolName ); - // clear display for original symbol + const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), + sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), + aSymbolSets.GetText() ); + + // remove old symbol if the name was changed then add new one +// const bool bSetNameChanged = aOldSymbolSets.GetText() != aSymbolSets.GetText(); + const bool bNameChanged = aOldSymbols.GetText() != aSymbols.GetText(); + if (bNameChanged) + aSymbolMgrCopy.RemoveSymbol( aOldSymbols.GetText() ); + aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true ); + + // clear display for original symbol if necessary + if (bNameChanged) SetOrigSymbol(NULL, XubString()); - } - //!! den SymbolSet Manger dazu zwingen seinen HashTable zu aktualisieren, - //!! um mit moeglich neuen bzw fehlenden alten Symbol Namen konform zu sein. - aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1); + // update display of new symbol + aSymbolDisplay.SetChar( aNewSymbol.GetCharacter() ); + aSymbolDisplay.SetFont( aNewSymbol.GetFace() ); + aSymbolName.SetText( aNewSymbol.GetName() ); + aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() ); + + // update list box entries + FillSymbolSets(aOldSymbolSets, FALSE); + FillSymbolSets(aSymbolSets, FALSE); + FillSymbols(aOldSymbols ,FALSE); + FillSymbols(aSymbols ,FALSE); UpdateButtons(); @@ -2012,33 +1972,16 @@ IMPL_LINK( SmSymDefineDialog, DeleteClickHdl, Button *, EMPTYARG pButton ) if (pOrigSymbol) { - // loeschen des Symbols: - // - // zugehoeriges SymbolSet finden - SmSymSet *pSymSet = GetSymbolSet(aOldSymbolSets); - // finden des Index - XubString aTmpOldSymbolName (pOrigSymbol->GetName()); - USHORT nSymbolNo = pSymSet->GetSymbolPos(aTmpOldSymbolName); - // Bezuege auf das Symbols loeschen + aSymbolMgrCopy.RemoveSymbol( pOrigSymbol->GetName() ); + + // clear display for original symbol SetOrigSymbol(NULL, XubString()); - // und weg mit dem Symbol - pSymSet->DeleteSymbol(nSymbolNo); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pSymSet, "Sm : NULL pointer"); - DBG_ASSERT(nSymbolNo != SYMBOL_NONE, "Sm : kein Symbol"); -#endif - //!! den SymbolSet Manger dazu zwingen seinen HashTable zu aktualisieren, - //!! was er naemlich nicht tut, wenn in einem seiner SymbolSets geaendert/ - //!! geloescht wird, was wiederum zu einem Absturz fuehren kann (wenn er - //!! ueber ein nicht mehr existentes aber nicht entferntes Symbol iteriert). - aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1); - - // aktualisieren der Symboleintraege des Dialogs - aOldSymbols.SetText(XubString()); - aOldSymbols.RemoveEntry(aTmpOldSymbolName); - if (aSymbolSets.GetText() == aOldSymbolSets.GetText()) - aSymbols.RemoveEntry(aTmpOldSymbolName); + // update list box entries + FillSymbolSets(aOldSymbolSets, FALSE); + FillSymbolSets(aSymbolSets, FALSE); + FillSymbols(aOldSymbols ,FALSE); + FillSymbols(aSymbols ,FALSE); } UpdateButtons(); @@ -2070,7 +2013,7 @@ void SmSymDefineDialog::UpdateButtons() && aCharsetDisplay.GetSelectCharacter() == pOrigSymbol->GetCharacter(); // hinzufuegen nur wenn es noch kein Symbol desgleichen Namens gibt - bAdd = aSymSetMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL; + bAdd = aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL; // loeschen nur wenn alle Einstellungen gleich sind bDelete = pOrigSymbol != NULL; @@ -2078,9 +2021,12 @@ void SmSymDefineDialog::UpdateButtons() // aendern wenn bei gleichem Namen mindestens eine Einstellung anders ist // oder wenn es noch kein Symbol des neuen Namens gibt (wuerde implizites // loeschen des bereits vorhandenen Symbols erfordern) - BOOL bEqualName = pOrigSymbol && aTmpSymbolName == pOrigSymbol->GetName(); - bChange = pOrigSymbol && ( (bEqualName && !bEqual) || (!bEqualName && bAdd) ); - } +// BOOL bEqualName = pOrigSymbol && aTmpSymbolName == pOrigSymbol->GetName(); +// bChange = pOrigSymbol && ( (bEqualName && !bEqual) || (!bEqualName && bAdd) ); + + // aendern nur falls altes Symbol vorhanden und am neuen etwas anders ist + bChange = pOrigSymbol && !bEqual; +} aAddBtn .Enable(bAdd); aChangeBtn.Enable(bChange); @@ -2089,7 +2035,7 @@ void SmSymDefineDialog::UpdateButtons() SmSymDefineDialog::SmSymDefineDialog(Window * pParent, - OutputDevice *pFntListDevice, SmSymSetManager &rMgr, BOOL bFreeRes) : + OutputDevice *pFntListDevice, SmSymbolManager &rMgr, BOOL bFreeRes) : ModalDialog (pParent, SmResId(RID_SYMDEFINEDIALOG)), aOldSymbolText (this, SmResId(1)), aOldSymbols (this, SmResId(1)), @@ -2120,7 +2066,7 @@ SmSymDefineDialog::SmSymDefineDialog(Window * pParent, aRightArrow (this, SmResId(1)), aRigthArrow_Im (SmResId(1)), aRigthArrow_Im_HC (SmResId(2)), // hi-contrast version - rSymSetMgr (rMgr), + rSymbolMgr (rMgr), pSubsetMap (NULL), pFontList (NULL) { @@ -2131,9 +2077,10 @@ SmSymDefineDialog::SmSymDefineDialog(Window * pParent, pOrigSymbol = 0; - // make autocompletion for symbols case-sensitive - aOldSymbols.EnableAutocomplete(TRUE, TRUE); - aSymbols .EnableAutocomplete(TRUE, TRUE); + // auto completion is troublesome since that symbols character also gets automatically selected in the + // display and if the user previously selected a character to define/redefine that one this is bad + aOldSymbols.EnableAutocomplete( FALSE, TRUE ); + aSymbols .EnableAutocomplete( FALSE, TRUE ); FillFonts(); if (aFonts.GetEntryCount() > 0) @@ -2141,7 +2088,7 @@ SmSymDefineDialog::SmSymDefineDialog(Window * pParent, InitColor_Impl(); - SetSymbolSetManager(rSymSetMgr); + SetSymbolSetManager(rSymbolMgr); aOldSymbols .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl)); aOldSymbolSets .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl)); @@ -2215,41 +2162,23 @@ short SmSymDefineDialog::Execute() short nResult = ModalDialog::Execute(); // Aenderungen uebernehmen falls Dialog mit OK beendet wurde - if (aSymSetMgrCopy.IsModified() && nResult == RET_OK) - { - // leere SymbolSets aus dem Ergebnis entfernen. - // Dabei von hinten durch das array iterieren, da beim loeschen die - // Elemente aufruecken. - USHORT nSymbolSets = aSymSetMgrCopy.GetSymbolSetCount(); - for (USHORT i = 0; i < nSymbolSets; i++) - { - USHORT nIdx = nSymbolSets - 1 - i; - if (aSymSetMgrCopy.GetSymbolSet(nIdx)->GetCount() == 0) - aSymSetMgrCopy.DeleteSymbolSet(nIdx); - } - - - - rSymSetMgr = aSymSetMgrCopy; -#ifdef DEBUG -// USHORT nS = rSymSetMgr.GetSymbolSetCount(); -#endif - } + if (aSymbolMgrCopy.IsModified() && nResult == RET_OK) + rSymbolMgr = aSymbolMgrCopy; return nResult; } -void SmSymDefineDialog::SetSymbolSetManager(const SmSymSetManager &rMgr) +void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr) { - aSymSetMgrCopy = rMgr; + aSymbolMgrCopy = rMgr; #ifdef DEBUG -// USHORT nS = aSymSetMgrCopy.GetSymbolSetCount(); +// USHORT nS = aSymbolMgrCopy.GetSymbolSetCount(); #endif // Das modified Flag der Kopie auf FALSE setzen, damit man spaeter damit // testen kann ob sich was geaendert hat. - aSymSetMgrCopy.SetModified(FALSE); + aSymbolMgrCopy.SetModified(FALSE); FillSymbolSets(aOldSymbolSets); if (aOldSymbolSets.GetEntryCount() > 0) @@ -2404,13 +2333,13 @@ BOOL SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox, { // bei Wechsel des alten Symbols nur vorhandene anzeigen sonst keins const SmSym *pOldSymbol = NULL; - XubString aTMpOldSymbolSetName; + XubString aTmpOldSymbolSetName; if (nPos != COMBOBOX_ENTRY_NOTFOUND) { - pOldSymbol = aSymSetMgrCopy.GetSymbolByName(aNormName); - aTMpOldSymbolSetName = aOldSymbolSets.GetText(); + pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName); + aTmpOldSymbolSetName = aOldSymbolSets.GetText(); } - SetOrigSymbol(pOldSymbol, aTMpOldSymbolSetName); + SetOrigSymbol(pOldSymbol, aTmpOldSymbolSetName); } else aSymbolName.SetText(rComboBox.GetText()); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ff2d5bed71a2..49739af72972 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -143,8 +143,8 @@ void SmDocShell::LoadSymbols() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::LoadSymbols" ); - SmModule *pp = SM_MOD1(); - pp->GetSymSetManager().Load(); + SmModule *pp = SM_MOD(); + pp->GetSymbolManager().Load(); } @@ -274,7 +274,7 @@ void SmDocShell::ArrangeFormula() pOutDev = &pView->GetGraphicWindow(); else { - pOutDev = &SM_MOD1()->GetDefaultVirtualDev(); + pOutDev = &SM_MOD()->GetDefaultVirtualDev(); pOutDev->SetMapMode( MapMode(MAP_100TH_MM) ); } } @@ -608,7 +608,7 @@ Printer* SmDocShell::GetPrt() SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, 0); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pOptions); pPrinter = new SfxPrinter(pOptions); pPrinter->SetMapMode( MapMode(MAP_100TH_MM) ); @@ -690,7 +690,7 @@ SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) : SetPool(&SFX_APP()->GetPool()); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); aFormat = pp->GetConfig()->GetStandardFormat(); StartListening(aFormat); @@ -705,7 +705,7 @@ SmDocShell::~SmDocShell() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::~SmDocShell" ); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); EndListening(aFormat); EndListening(*pp->GetConfig()); @@ -1001,7 +1001,7 @@ void SmDocShell::Execute(SfxRequest& rReq) case SID_AUTO_REDRAW : { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); BOOL bRedraw = pp->GetConfig()->IsAutoRedraw(); pp->GetConfig()->SetAutoRedraw(!bRedraw); } @@ -1020,7 +1020,7 @@ void SmDocShell::Execute(SfxRequest& rReq) // get device used to retrieve the FontList OutputDevice *pDev = GetPrinter(); if (!pDev || pDev->GetDevFontCount() == 0) - pDev = &SM_MOD1()->GetDefaultVirtualDev(); + pDev = &SM_MOD()->GetDefaultVirtualDev(); DBG_ASSERT (pDev, "device for font list missing" ); SmFontTypeDialog *pFontTypeDialog = new SmFontTypeDialog( NULL, pDev ); @@ -1104,7 +1104,7 @@ void SmDocShell::Execute(SfxRequest& rReq) pAlignDialog->WriteTo(aNewFormat); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); pAlignDialog->WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -1201,7 +1201,7 @@ void SmDocShell::GetState(SfxItemSet &rSet) case SID_AUTO_REDRAW : { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); BOOL bRedraw = pp->GetConfig()->IsAutoRedraw(); rSet.Put(SfxBoolItem(SID_AUTO_REDRAW, bRedraw)); @@ -1290,8 +1290,8 @@ void SmDocShell::SaveSymbols() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::SaveSymbols" ); - SmModule *pp = SM_MOD1(); - pp->GetSymSetManager().Save(); + SmModule *pp = SM_MOD(); + pp->GetSymbolManager().Save(); } diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 94e30ce82501..f7093f9c3815 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -113,14 +113,13 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : // Even RTL languages don't use RTL for math rCmdBox.GetEditWindow()->EnableRTL( FALSE ); - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); // compare DataChanged SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl)); - aModifyTimer.SetTimeout(2000); - aModifyTimer.Start(); + aModifyTimer.SetTimeout(500); aCursorMoveTimer.SetTimeoutHdl(LINK(this, SmEditWindow, CursorMoveTimerHdl)); aCursorMoveTimer.SetTimeout(500); @@ -216,7 +215,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) { const StyleSettings aSettings( GetSettings().GetStyleSettings() ); - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); SetBackground( aSettings.GetWindowColor() ); // edit fields in other Applications use this font instead of @@ -250,10 +249,9 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ ) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); if (pp->GetConfig()->IsAutoRedraw()) Flush(); - aModifyTimer.Start(); return 0; } @@ -882,7 +880,10 @@ void SmEditWindow::Cut() { DBG_ASSERT( pEditView, "EditView missing" ); if (pEditView) + { pEditView->Cut(); + GetDoc()->SetModified( TRUE ); + } } void SmEditWindow::Copy() @@ -896,14 +897,20 @@ void SmEditWindow::Paste() { DBG_ASSERT( pEditView, "EditView missing" ); if (pEditView) + { pEditView->Paste(); + GetDoc()->SetModified( TRUE ); + } } void SmEditWindow::Delete() { DBG_ASSERT( pEditView, "EditView missing" ); if (pEditView) + { pEditView->DeleteSelected(); + GetDoc()->SetModified( TRUE ); + } } void SmEditWindow::InsertText(const String& Text) diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index a69a90010700..6b100ee606f2 100644 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -48,32 +48,32 @@ SRC2FILES = smres.src \ commands.src SLO1FILES = \ - $(SLO)$/register.obj \ - $(SLO)$/typemap.obj \ + $(SLO)$/accessibility.obj \ + $(SLO)$/edit.obj \ + $(SLO)$/eqnolefilehdr.obj \ + $(SLO)$/mathmlexport.obj \ + $(SLO)$/mathmlimport.obj \ $(SLO)$/symbol.obj \ - $(SLO)$/toolbox.obj \ + $(SLO)$/types.obj \ + $(SLO)$/unodoc.obj \ $(SLO)$/action.obj \ - $(SLO)$/accessibility.obj \ $(SLO)$/cfgitem.obj \ $(SLO)$/config.obj \ $(SLO)$/dialog.obj \ $(SLO)$/document.obj \ - $(SLO)$/mathtype.obj \ - $(SLO)$/mathmlimport.obj \ - $(SLO)$/mathmlexport.obj \ $(SLO)$/format.obj \ + $(SLO)$/mathtype.obj \ $(SLO)$/node.obj \ $(SLO)$/parse.obj \ - $(SLO)$/utility.obj \ + $(SLO)$/register.obj \ $(SLO)$/smdll.obj \ + $(SLO)$/toolbox.obj \ + $(SLO)$/typemap.obj \ $(SLO)$/smmod.obj \ - $(SLO)$/types.obj \ - $(SLO)$/view.obj \ - $(SLO)$/edit.obj \ + $(SLO)$/utility.obj \ $(SLO)$/rect.obj \ $(SLO)$/unomodel.obj \ - $(SLO)$/unodoc.obj \ - $(SLO)$/eqnolefilehdr.obj + $(SLO)$/view.obj SLO2FILES = \ $(SLO)$/register.obj \ @@ -88,6 +88,7 @@ EXCEPTIONSFILES = \ $(SLO)$/register.obj \ $(SLO)$/accessibility.obj \ $(SLO)$/cfgitem.obj \ + $(SLO)$/dialog.obj \ $(SLO)$/document.obj \ $(SLO)$/node.obj \ $(SLO)$/parse.obj \ diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 722df5a1d502..9999205ad83f 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -115,7 +115,7 @@ Color SmTmpDevice::Impl_GetColor( const Color& rColor ) if (OUTDEV_WINDOW == rOutDev.GetOutDevType()) aBgCol = ((Window &) rOutDev).GetDisplayBackground().GetColor(); - nNewCol = SM_MOD1()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + nNewCol = SM_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; Color aTmpColor( nNewCol ); if (aBgCol.IsDark() && aTmpColor.IsDark()) @@ -2803,9 +2803,9 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell SmNode::Prepare(rFormat, rDocShell); const SmSym *pSym; - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); - if (NULL != (pSym = pp->GetSymSetManager().GetSymbolByName(GetToken().aText))) + if (NULL != (pSym = pp->GetSymbolManager().GetSymbolByName(GetToken().aText))) { SetText( pSym->GetCharacter() ); GetFont() = pSym->GetFace(); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 1955b0553b62..9b18f6a427a1 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -380,7 +380,7 @@ BOOL SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos ) BOOL bIsDelim = *pDelim != 0; - INT16 nTypJp = SM_MOD1()->GetSysLocale().GetCharClass().getType( rTxt, nPos ); + INT16 nTypJp = SM_MOD()->GetSysLocale().GetCharClass().getType( rTxt, nPos ); bIsDelim |= nTypJp == com::sun::star::i18n::UnicodeType::SPACE_SEPARATOR || nTypJp == com::sun::star::i18n::UnicodeType::CONTROL; @@ -438,7 +438,7 @@ void SmParser::NextToken() xub_StrLen nRealStart; BOOL bCont; BOOL bNumStart = FALSE; - CharClass aCC(SM_MOD1()->GetSysLocale().GetCharClass().getLocale()); + CharClass aCC(SM_MOD()->GetSysLocale().GetCharClass().getLocale()); do { // skip white spaces @@ -1362,7 +1362,7 @@ void SmParser::Blank() // Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist if ( CurToken.eType == TNEWLINE || - (CurToken.eType == TEND && SM_MOD1()->GetConfig()->IsIgnoreSpacesRight()) ) + (CurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) ) { pBlankNode->Clear(); } @@ -2286,13 +2286,13 @@ void SmParser::Special() // UI uses localized names XML file format does not.) if (IsImportSymbolNames()) { - const SmLocalizedSymbolData &rLSD = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); aNewName = rLSD.GetUiSymbolName( rName ); bReplace = TRUE; } else if (IsExportSymbolNames()) { - const SmLocalizedSymbolData &rLSD = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); aNewName = rLSD.GetExportSymbolName( rName ); bReplace = TRUE; } @@ -2300,7 +2300,7 @@ void SmParser::Special() else // 5.0 <-> 6.0 formula text (symbol name) conversion { LanguageType nLanguage = GetLanguage(); - SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray *pFrom = 0; const ResStringArray *pTo = 0; if (CONVERT_50_TO_60 == GetConversion()) diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index 02df2ddf060e..248983a393a8 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -715,7 +715,7 @@ BOOL SmGetGlyphBoundRect(const OutputDevice &rDev, { // since we format for the printer (where GetTextBoundRect will fail) // we need a virtual device here. - pGlyphDev = &SM_MOD1()->GetDefaultVirtualDev(); + pGlyphDev = &SM_MOD()->GetDefaultVirtualDev(); } const FontMetric aDevFM (rDev.GetFontMetric()); diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx index f72ab2be84cb..a66ec8efc608 100644 --- a/starmath/source/smdll.cxx +++ b/starmath/source/smdll.cxx @@ -76,7 +76,7 @@ void SmDLL::Init() SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM); *ppShlPtr = new SmModule( &rFactory ); - SfxModule *p = SM_MOD1(); + SfxModule *p = SM_MOD(); SmModule *pp = (SmModule *) p; rFactory.SetDocumentServiceName( String::CreateFromAscii("com.sun.star.formula.FormulaProperties") ); diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 451bb8664bc5..da6259076adc 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -98,7 +98,7 @@ const String SmLocalizedSymbolData::GetUiSymbolName( const String &rExportName ) { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rExportNames.Count()); @@ -119,7 +119,7 @@ const String SmLocalizedSymbolData::GetExportSymbolName( const String &rUiName ) { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rUiNames.Count()); @@ -140,7 +140,7 @@ const String SmLocalizedSymbolData::GetUiSymbolSetName( const String &rExportNam { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rExportNames.Count()); @@ -161,7 +161,7 @@ const String SmLocalizedSymbolData::GetExportSymbolSetName( const String &rUiNam { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rUiNames.Count()); @@ -311,9 +311,9 @@ SmConfig * SmModule::GetConfig() return pConfig; } -SmSymSetManager & SmModule::GetSymSetManager() +SmSymbolManager & SmModule::GetSymbolManager() { - return GetConfig()->GetSymSetManager(); + return GetConfig()->GetSymbolManager(); } SmLocalizedSymbolData & SmModule::GetLocSymbolData() const diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 7d2799b71647..e248f9726629 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -34,12 +34,13 @@ #include <ucbhelper/content.hxx> #include <vcl/msgbox.hxx> -#ifndef _SV_RESARY_HXX -#include <tools/resary.hxx> -#endif #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> +#include <map> +#include <vector> +#include <iterator> + #include "symbol.hxx" #include "view.hxx" #include "utility.hxx" @@ -55,72 +56,38 @@ using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::uno; using namespace ::rtl; -// Das hier muss auch mal alles "uberarbeitet werden. Insbesondere die nicht -// funktionierende und bei l"oschen/"andern von Symbolen nicht gepflegte -// Hash Tabelle!!! Diese aktualisert sich erst im Wertzuweisungsoperator -// beim Verlassen des 'SmSymDefineDialog's! - -/**************************************************************************/ -/* -** -** MACRO DEFINTION -** -**/ - -#define SF_SM20IDENT 0x03031963L -#define SF_IDENT 0x30334D53L - - -SV_IMPL_PTRARR( SymbolArray, SmSym * ); - -/**************************************************************************/ -/* -** -** DATA DEFINITION -** -**/ - -long SF_Ident = SF_IDENT; /**************************************************************************/ -/* -** -** CLASS IMPLEMENTATION -** -**/ SmSym::SmSym() : - Name(C2S("unknown")), - aSetName(C2S("unknown")), - pHashNext(0), - pSymSetManager(0), - Character('\0'), - bPredefined(FALSE), - bDocSymbol(FALSE) + m_aName(C2S("unknown")), + m_aSetName(C2S("unknown")), + m_cChar('\0'), + m_bPredefined(FALSE), + m_bDocSymbol(FALSE) { - aExportName = Name; - Face.SetTransparent(TRUE); - Face.SetAlign(ALIGN_BASELINE); + m_aExportName = m_aName; + m_aFace.SetTransparent(TRUE); + m_aFace.SetAlign(ALIGN_BASELINE); } SmSym::SmSym(const SmSym& rSymbol) { - pSymSetManager = 0; *this = rSymbol; } -SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar, +SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode cChar, const String& rSet, BOOL bIsPredefined) { - Name = aExportName = rName; + m_aName = m_aExportName = rName; - Face = rFont; - Face.SetTransparent(TRUE); - Face.SetAlign(ALIGN_BASELINE); + m_aFace = rFont; + m_aFace.SetTransparent(TRUE); + m_aFace.SetAlign(ALIGN_BASELINE); - Character = aChar; + m_cChar = cChar; //! according to HDU this should not be used anymore now //! since this was necessary in the early days but should //! not be done now since this is handled now at a more @@ -132,481 +99,231 @@ SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar, // // if (RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet()) // Character |= 0xF000; - aSetName = rSet; - bPredefined = bIsPredefined; - bDocSymbol = FALSE; - - pHashNext = 0; - pSymSetManager = 0; + m_aSetName = rSet; + m_bPredefined = bIsPredefined; + m_bDocSymbol = FALSE; } SmSym& SmSym::operator = (const SmSym& rSymbol) { - Name = rSymbol.Name; - Face = rSymbol.Face; - Character = rSymbol.Character; - aSetName = rSymbol.aSetName; - bPredefined = rSymbol.bPredefined; - bDocSymbol = rSymbol.bDocSymbol; - aExportName = rSymbol.aExportName; - - pHashNext = 0; - - if (pSymSetManager) - pSymSetManager->SetModified(TRUE); - - return *this; -} - -/**************************************************************************/ - -SmSymSet::SmSymSet() : - Name(C2S("unknown")), - pSymSetManager(0) -{ - SymbolList.Clear(); -} - -SmSymSet::SmSymSet(const SmSymSet& rSymbolSet) -{ - pSymSetManager = 0; - *this = rSymbolSet; -} - -SmSymSet::SmSymSet(const String& rName) -{ - Name = rName; - SymbolList.Clear(); - - pSymSetManager = 0; -} - -SmSymSet::~SmSymSet() -{ - for (USHORT i = 0; i < GetCount(); i++) - delete SymbolList.GetObject(i); -} - -SmSymSet& SmSymSet::operator = (const SmSymSet& rSymbolSet) -{ - USHORT i; - for (i = 0; i < GetCount(); i++) - delete SymbolList.GetObject(i); - - Name = rSymbolSet.Name; - SymbolList.Clear(); - for (i = 0; i < rSymbolSet.GetCount(); i++) - AddSymbol(new SmSym(rSymbolSet.GetSymbol(i))); + m_aName = rSymbol.m_aName; + m_aExportName = rSymbol.m_aExportName; + m_cChar = rSymbol.m_cChar; + m_aFace = rSymbol.m_aFace; + m_aSetName = rSymbol.m_aSetName; + m_bPredefined = rSymbol.m_bPredefined; + m_bDocSymbol = rSymbol.m_bDocSymbol; + SmSymbolManager * pSymSetManager = &SM_MOD()->GetSymbolManager(); if (pSymSetManager) - pSymSetManager->SetModified(TRUE); + pSymSetManager->SetModified(true); return *this; } -USHORT SmSymSet::AddSymbol(SmSym* pSymbol) -{ - DBG_ASSERT(pSymbol, "Kein Symbol"); - - if (pSymbol) - pSymbol->SetSetName( GetName() ); - SymbolList.Insert(pSymbol, LIST_APPEND); - DBG_ASSERT(SymbolList.GetPos(pSymbol) == SymbolList.Count() - 1, - "Sm : ... ergibt falschen return Wert"); - - if (pSymSetManager) - pSymSetManager->SetModified(TRUE); - - return (USHORT) SymbolList.Count() - 1; -} - -void SmSymSet::DeleteSymbol(USHORT SymbolNo) -{ - delete RemoveSymbol(SymbolNo); -} - -SmSym * SmSymSet::RemoveSymbol(USHORT SymbolNo) -{ - DBG_ASSERT(SymbolList.GetObject(SymbolNo), "Symbol nicht vorhanden"); - - SmSym *pSym = SymbolList.GetObject(SymbolNo); - SymbolList.Remove(SymbolNo); - - if (pSymSetManager) - pSymSetManager->SetModified(TRUE); - - return pSym; -} - -USHORT SmSymSet::GetSymbolPos(const String& rName) -{ - for (USHORT i = 0; i < GetCount(); i++) - if (SymbolList.GetObject(i)->GetName() == rName) - return (i); - return SYMBOL_NONE; -} - -/**************************************************************************/ - -SmSymSetManager_Impl::SmSymSetManager_Impl( - SmSymSetManager &rMgr, USHORT HashTableSize ) : - - rSymSetMgr (rMgr) -{ - NoSymbolSets = 0; - NoHashEntries = HashTableSize; - HashEntries = new SmSym *[NoHashEntries]; - memset( HashEntries, 0, sizeof(SmSym *) * NoHashEntries ); - Modified = FALSE; -} - - -SmSymSetManager_Impl::~SmSymSetManager_Impl() +bool SmSym::IsEqualInUI( const SmSym& rSymbol ) const { - for (USHORT i = 0; i < NoSymbolSets; ++i) - delete SymbolSets.Get(i); - SymbolSets.Clear(); - - NoSymbolSets = 0; - if (HashEntries) - { - delete[] HashEntries; - HashEntries = 0; - } - NoHashEntries = 0; - Modified = FALSE; -} - - -SmSymSetManager_Impl & SmSymSetManager_Impl::operator = ( const SmSymSetManager_Impl &rImpl ) -{ - //! rMySymSetMgr remains unchanged - - NoHashEntries = rImpl.NoHashEntries; - if (HashEntries) - delete [] HashEntries; - HashEntries = new SmSym *[NoHashEntries]; - memset( HashEntries, 0, sizeof(SmSym *) * NoHashEntries ); - - NoSymbolSets = 0; - SymbolSets.Clear(); - for (USHORT i = 0; i < rImpl.NoSymbolSets; ++i) - { - rSymSetMgr.AddSymbolSet( new SmSymSet( *rImpl.rSymSetMgr.GetSymbolSet(i) ) ); - } - DBG_ASSERT( NoSymbolSets == rImpl.NoSymbolSets, - "incorrect number of symbolsets" ); - - Modified = TRUE; - return *this; + return m_aName == rSymbol.m_aName && + m_aFace == rSymbol.m_aFace && + m_cChar == rSymbol.m_cChar; } /**************************************************************************/ -void SmSymSetManager::SFX_NOTIFY(SfxBroadcaster& /*rBC*/, const TypeId& rBCType, +void SmSymbolManager::SFX_NOTIFY(SfxBroadcaster& /*rBC*/, const TypeId& rBCType, const SfxHint& /*rHint*/, const TypeId& rHintType) { } -UINT32 SmSymSetManager::GetHashIndex(const String& rSymbolName) -{ - UINT32 x = 1; - for (xub_StrLen i = 0; i < rSymbolName.Len(); i++) - x += x * rSymbolName.GetChar(i) + i; - - return x % pImpl->NoHashEntries; -} - - -void SmSymSetManager::EnterHashTable(SmSym& rSymbol) -{ - int j = GetHashIndex( rSymbol.GetName() ); - if (pImpl->HashEntries[j] == 0) - pImpl->HashEntries[j] = &rSymbol; - else - { - SmSym *p = pImpl->HashEntries[j]; - while (p->pHashNext) - p = p->pHashNext; - p->pHashNext = &rSymbol; - } - rSymbol.pHashNext = 0; -} - - -void SmSymSetManager::EnterHashTable(SmSymSet& rSymbolSet) -{ - for (USHORT i = 0; i < rSymbolSet.GetCount(); i++) - EnterHashTable( *rSymbolSet.SymbolList.GetObject(i) ); -} - -void SmSymSetManager::FillHashTable() -{ - if (pImpl->HashEntries) - { - memset( pImpl->HashEntries, 0, pImpl->NoHashEntries * sizeof(SmSym *) ); - - for (UINT32 i = 0; i < pImpl->NoSymbolSets; i++) - EnterHashTable( *GetSymbolSet( (USHORT) i ) ); - } -} - -void SmSymSetManager::Init() +void SmSymbolManager::Init() { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); StartListening(*pp->GetConfig()); } -void SmSymSetManager::Exit() +void SmSymbolManager::Exit() { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); EndListening(*pp->GetConfig()); } -SmSymSetManager::SmSymSetManager(USHORT HashTableSize) +SmSymbolManager::SmSymbolManager() { - pImpl = new SmSymSetManager_Impl( *this, HashTableSize ); + m_bModified = false; } -SmSymSetManager::SmSymSetManager(const SmSymSetManager& rSymbolSetManager) : +SmSymbolManager::SmSymbolManager(const SmSymbolManager& rSymbolSetManager) : SfxListener() { - pImpl = new SmSymSetManager_Impl( *this, rSymbolSetManager.pImpl->NoHashEntries ); - *pImpl = *rSymbolSetManager.pImpl; + m_aSymbols = rSymbolSetManager.m_aSymbols; + m_bModified = true; } -SmSymSetManager::~SmSymSetManager() +SmSymbolManager::~SmSymbolManager() { - delete pImpl; - pImpl = 0; } -SmSymSetManager& SmSymSetManager::operator = (const SmSymSetManager& rSymbolSetManager) + +SmSymbolManager& SmSymbolManager::operator = (const SmSymbolManager& rSymbolSetManager) { - *pImpl = *rSymbolSetManager.pImpl; + m_aSymbols = rSymbolSetManager.m_aSymbols; + m_bModified = true; return *this; } -USHORT SmSymSetManager::AddSymbolSet(SmSymSet* pSymbolSet) -{ - if (pImpl->NoSymbolSets >= pImpl->SymbolSets.GetSize()) - pImpl->SymbolSets.SetSize(pImpl->NoSymbolSets + 1); - - pImpl->SymbolSets.Put(pImpl->NoSymbolSets++, pSymbolSet); - pSymbolSet->pSymSetManager = this; - - for (USHORT i = 0; i < pSymbolSet->GetCount(); i++) - pSymbolSet->SymbolList.GetObject(i)->pSymSetManager = this; - - FillHashTable(); - pImpl->Modified = TRUE; - - return (USHORT) (pImpl->NoSymbolSets - 1); -} - -void SmSymSetManager::ChangeSymbolSet(SmSymSet* pSymbolSet) +SmSym *SmSymbolManager::GetSymbolByName(const String& rSymbolName) { - if (pSymbolSet) - { - FillHashTable(); - pImpl->Modified = TRUE; - } + SmSym *pRes = NULL; + SymbolMap_t::iterator aIt( m_aSymbols.find( rSymbolName ) ); + if (aIt != m_aSymbols.end()) + pRes = &aIt->second; + return pRes; } -void SmSymSetManager::DeleteSymbolSet(USHORT SymbolSetNo) -{ - delete pImpl->SymbolSets.Get(SymbolSetNo); - pImpl->NoSymbolSets--; - - for (UINT32 i = SymbolSetNo; i < pImpl->NoSymbolSets; i++) - pImpl->SymbolSets.Put(i, pImpl->SymbolSets.Get(i + 1)); - - FillHashTable(); - pImpl->Modified = TRUE; +const SymbolPtrVec_t SmSymbolManager::GetSymbols() const +{ + SymbolPtrVec_t aRes; + SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); + for ( ; aIt != m_aSymbols.end(); ++aIt) + aRes.push_back( &aIt->second ); +// DBG_ASSERT( sSymbols.size() == m_aSymbols.size(), "number of symbols mismatch " ); + return aRes; } -USHORT SmSymSetManager::GetSymbolSetPos(const String& rSymbolSetName) const +bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChange ) { - for (USHORT i = 0; i < pImpl->NoSymbolSets; i++) - if (pImpl->SymbolSets.Get(i)->GetName() == rSymbolSetName) - return (i); - - return SYMBOLSET_NONE; -} + bool bAdded = false; -SmSym *SmSymSetManager::GetSymbolByName(const String& rSymbolName) -{ - SmSym *pSym = pImpl->HashEntries[GetHashIndex(rSymbolName)]; - while (pSym) + const String aSymbolName( rSymbol.GetName() ); + if (aSymbolName.Len() > 0 && rSymbol.GetSymbolSetName().Len() > 0) { - if (pSym->Name == rSymbolName) - break; - pSym = pSym->pHashNext; - } - - return pSym; -} + const SmSym *pFound = GetSymbolByName( aSymbolName ); + const bool bSymbolConflict = pFound && !pFound->IsEqualInUI( rSymbol ); - -void SmSymSetManager::AddReplaceSymbol( const SmSym &rSymbol ) -{ - SmSym *pSym = GetSymbolByName( rSymbol.GetName() ); - if (pSym) - { - *pSym = rSymbol; - } - else - { - USHORT nPos = GetSymbolSetPos( rSymbol.GetSetName() ); - if (SYMBOLSET_NONE == nPos) + // avoid having the same symbol name twice but with different symbols in use + if (!pFound || bForceChange) { - AddSymbolSet( new SmSymSet( rSymbol.GetSetName() ) ); - nPos = GetSymbolSetPos( rSymbol.GetSetName() ); + m_aSymbols[ aSymbolName ] = rSymbol; + bAdded = true; + } + else if (pFound && !bForceChange && bSymbolConflict) + { + // TODO: but what ... + DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" ); } - DBG_ASSERT( nPos != SYMBOLSET_NONE, "SymbolSet not found"); - SmSym *pTmpSym = new SmSym( rSymbol ); - GetSymbolSet( nPos )->AddSymbol( pTmpSym ); - EnterHashTable( *pTmpSym ); } - SetModified( TRUE ); -} + DBG_ASSERT( bAdded, "failed to add symbol" ); + if (bAdded) + m_bModified = true; -USHORT SmSymSetManager::GetSymbolCount() const -{ - USHORT nRes = 0; - USHORT nSets = GetSymbolSetCount(); - for (USHORT i = 0; i < nSets; ++i) - nRes = nRes + GetSymbolSet(i)->GetCount(); - return nRes; + return bAdded; } -const SmSym * SmSymSetManager::GetSymbolByPos( USHORT nPos ) const +void SmSymbolManager::RemoveSymbol( const String & rSymbolName ) { - const SmSym *pRes = 0; - - INT16 nIdx = 0; - USHORT nSets = GetSymbolSetCount(); - USHORT i = 0; - while (i < nSets && !pRes) + if (rSymbolName.Len() > 0) { - USHORT nEntries = GetSymbolSet(i)->GetCount(); - if (nPos < nIdx + nEntries) - pRes = &GetSymbolSet(i)->GetSymbol( nPos - nIdx ); - else - nIdx = nIdx + nEntries; - ++i; + size_t nOldSize = m_aSymbols.size(); + m_aSymbols.erase( rSymbolName ); + m_bModified = nOldSize != m_aSymbols.size(); } +} - return pRes; + +std::set< String > SmSymbolManager::GetSymbolSetNames() const +{ + std::set< String > aRes; + SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); + for ( ; aIt != m_aSymbols.end(); ++aIt ) + aRes.insert( aIt->second.GetSymbolSetName() ); + return aRes; } -void SmSymSetManager::GetSymbols( std::vector< SmSym > &rSymbols ) const +const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const String& rSymbolSetName ) { - INT32 nCount = GetSymbolCount(); - rSymbols.resize( nCount ); - USHORT nPos = 0; - std::vector< SmSym >::iterator aIt( rSymbols.begin() ); - std::vector< SmSym >::iterator aEnd( rSymbols.end() ); - while (aIt != aEnd) + SymbolPtrVec_t aRes; + if (rSymbolSetName.Len() > 0) { - const SmSym *pSym = GetSymbolByPos( nPos++ ); - DBG_ASSERT( pSym, "symbol missing" ); - if (pSym) - *aIt++ = *pSym; + SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); + for ( ; aIt != m_aSymbols.end(); ++aIt ) + { + if (aIt->second.GetSymbolSetName() == rSymbolSetName) + aRes.push_back( &aIt->second ); + } } - DBG_ASSERT( nPos == nCount, "index out of range?" ); + return aRes; } -void SmSymSetManager::Load() +void SmSymbolManager::Load() { std::vector< SmSym > aSymbols; - SmMathConfig &rCfg = *SM_MOD1()->GetConfig(); + SmMathConfig &rCfg = *SM_MOD()->GetConfig(); rCfg.GetSymbols( aSymbols ); - INT32 nSymbolCount = aSymbols.size(); + size_t nSymbolCount = aSymbols.size(); - USHORT i; - for (i = 0; i < nSymbolCount; ++i) + m_aSymbols.clear(); + for (size_t i = 0; i < nSymbolCount; ++i) { const SmSym &rSym = aSymbols[i]; - DBG_ASSERT( rSym.Name.Len() > 0, "symbol without name!" ); - if (rSym.Name.Len() > 0) - { - SmSymSet *pSymSet = 0; - const String &rSetName = rSym.GetSetName(); - USHORT nSetPos = GetSymbolSetPos( rSetName ); - if (SYMBOLSET_NONE != nSetPos) - pSymSet = GetSymbolSet( nSetPos ); - else - { - pSymSet = new SmSymSet( rSetName ); - AddSymbolSet( pSymSet ); - } - - pSymSet->AddSymbol( new SmSym( rSym ) ); - } + DBG_ASSERT( rSym.GetName().Len() > 0, "symbol without name!" ); + if (rSym.GetName().Len() > 0) + AddOrReplaceSymbol( rSym ); } - // build HashTables - INT32 nSymbolSetCount = GetSymbolSetCount(); - for (i = 0; i < nSymbolSetCount; ++i) - ChangeSymbolSet( GetSymbolSet( i ) ); + m_bModified = true; if (0 == nSymbolCount) { DBG_ERROR( "no symbol set found" ); - pImpl->Modified = FALSE; + m_bModified = false; } } -void SmSymSetManager::Save() +void SmSymbolManager::Save() { - SmMathConfig &rCfg = *SM_MOD1()->GetConfig(); - - // get number of Symbols - USHORT nSymbolCount = 0; - USHORT nSetCount = GetSymbolSetCount(); - USHORT i; - for (i = 0; i < nSetCount; ++i) - nSymbolCount = nSymbolCount + GetSymbolSet( i )->GetCount(); - - if (nSymbolCount) + if (m_bModified) { - USHORT nSaveSymbolCnt = 0; - const SmSym **pSymbols = new const SmSym* [ nSymbolCount ]; - const SmSym **pSym = pSymbols; - for (i = 0; i < nSetCount; ++i) + SmMathConfig &rCfg = *SM_MOD()->GetConfig(); + +#if 0 + USHORT nSymbolCount = GetSymbolCount(); + USHORT nSaveSymbolCnt = 0; + const SmSym **pSymbols = new const SmSym* [ nSymbolCount ]; + const SmSym **pSym = pSymbols; + for (USHORT j = 0; j < nSymbolCount; ++j) { - const SmSymSet *pSymSet = GetSymbolSet( i ); - USHORT n = pSymSet->GetCount(); - for (USHORT j = 0; j < n; ++j) + const SmSym &rSym = *pSymSet->GetSymbol( j ); + if (!rSym.IsDocSymbol()) { - const SmSym &rSym = pSymSet->GetSymbol( j ); - if (!rSym.IsDocSymbol()) - { - *pSym++ = &rSym; - ++nSaveSymbolCnt; - } + *pSym++ = &rSym; + ++nSaveSymbolCnt; } } DBG_ASSERT(pSym - pSymbols == nSaveSymbolCnt, "wrong number of symbols" ); - +#endif + SymbolPtrVec_t aTmp( GetSymbols() ); std::vector< SmSym > aSymbols; - GetSymbols( aSymbols ); + for (size_t i = 0; i < aTmp.size(); ++i) + aSymbols.push_back( *aTmp[i] ); rCfg.SetSymbols( aSymbols ); +#if 0 delete [] pSymbols; +#endif + + m_bModified = false; } } diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index f4acc1af6b89..013831f6e44e 100644..100755 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -85,7 +85,7 @@ SmPrintUIOptions::SmPrintUIOptions() if( aLocalizedStrings.Count() < 18 ) // bad resource ? return; - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmConfig *pConfig = pp->GetConfig(); DBG_ASSERT( pConfig, "SmConfig not found" ); if (!pConfig) @@ -684,7 +684,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* 0 }; SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange ); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pItemSet); SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); @@ -701,8 +701,8 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* if ( *pValues >>= aSequence ) { sal_uInt32 nSize = aSequence.getLength(); - SmModule *pp = SM_MOD1(); - SmSymSetManager &rManager = pp->GetSymSetManager(); + SmModule *pp = SM_MOD(); + SmSymbolManager &rManager = pp->GetSymbolManager(); SymbolDescriptor *pDescriptor = aSequence.getArray(); for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++) { @@ -717,7 +717,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pDescriptor->sSymbolSet ); aSymbol.SetExportName ( pDescriptor->sExportName ); aSymbol.SetDocSymbol( TRUE ); - rManager.AddReplaceSymbol ( aSymbol ); + rManager.AddOrReplaceSymbol ( aSymbol ); } } else @@ -886,14 +886,15 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu case HANDLE_SYMBOLS: { // this is get - SmModule *pp = SM_MOD1(); - const SmSymSetManager &rManager = pp->GetSymSetManager(); + SmModule *pp = SM_MOD(); + const SmSymbolManager &rManager = pp->GetSymbolManager(); vector < const SmSym * > aVector; - USHORT nCount = 0; - for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++) + const SymbolPtrVec_t aSymbols( rManager.GetSymbols() ); + size_t nCount = 0; + for (size_t i = 0; i < aSymbols.size(); ++i) { - const SmSym * pSymbol = rManager.GetSymbolByPos( i ); + const SmSym * pSymbol = aSymbols[ i ]; if (pSymbol && !pSymbol->IsPredefined () ) { aVector.push_back ( pSymbol ); @@ -903,12 +904,12 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu Sequence < SymbolDescriptor > aSequence ( nCount ); SymbolDescriptor * pDescriptor = aSequence.getArray(); - vector <const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); + vector < const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); for(; aIter != aEnd; pDescriptor++, aIter++) { pDescriptor->sName = (*aIter)->GetName(); pDescriptor->sExportName = (*aIter)->GetExportName(); - pDescriptor->sSymbolSet = (*aIter)->GetSetName(); + pDescriptor->sSymbolSet = (*aIter)->GetSymbolSetName(); pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter()); Font rFont = (*aIter)->GetFace(); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index e935958102a7..886d409931b2 100644..100755 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -107,7 +107,7 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell): const Fraction aFraction (1,1); SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction)); - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); SetTotalSize(); @@ -145,7 +145,7 @@ void SmGraphicWindow::ApplyColorConfigValues( const svtools::ColorConfig &rColor void SmGraphicWindow::DataChanged( const DataChangedEvent& rEvt ) { - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); ScrollableWindow::DataChanged( rEvt ); } @@ -270,7 +270,7 @@ void SmGraphicWindow::SetCursor(const Rectangle &rRect) // The old cursor will be removed, and the new one will be shown if // that is activated in the ConfigItem { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); if (IsCursorVisible()) ShowCursor(FALSE); // clean up remainings of old cursor @@ -324,7 +324,7 @@ void SmGraphicWindow::Paint(const Rectangle&) nCol++; const SmNode *pFound = SetCursorPos(nRow, nCol); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); if (pFound && pp->GetConfig()->IsShowFormulaCursor()) ShowCursor(TRUE); } @@ -1163,7 +1163,7 @@ void SmViewShell::Impl_Print( USHORT SmViewShell::Print(SfxProgress & /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog * /*pPrintDialog*/) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Print" ); - DBG_ASSERT( 0, "SmViewShell::Print: no longer usewd with new UI print dialog. Should be removed!!" ); + DBG_ASSERT( 0, "SmViewShell::Print: no longer used with new UI print dialog. Should be removed!!" ); return 0; } @@ -1191,7 +1191,7 @@ USHORT SmViewShell::SetPrinter(SfxPrinter *pNewPrinter, USHORT nDiffFlags, bool if ((nDiffFlags & SFX_PRINTER_OPTIONS) == SFX_PRINTER_OPTIONS) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->ItemSetToConfig(pNewPrinter->GetOptions()); } return 0; @@ -1379,7 +1379,7 @@ void SmViewShell::Execute(SfxRequest& rReq) { case SID_FORMULACURSOR: { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem *pItem; @@ -1681,11 +1681,11 @@ void SmViewShell::Execute(SfxRequest& rReq) SmDocShell *pDoc = GetDoc(); OutputDevice *pDev = pDoc->GetPrinter(); if (!pDev || pDev->GetDevFontCount() == 0) - pDev = &SM_MOD1()->GetDefaultVirtualDev(); + pDev = &SM_MOD()->GetDefaultVirtualDev(); DBG_ASSERT (pDev, "device for font list missing" ); - SmModule *pp = SM_MOD1(); - SmSymbolDialog( NULL, pDev, pp->GetSymSetManager(), *this ).Execute(); + SmModule *pp = SM_MOD(); + SmSymbolDialog( NULL, pDev, pp->GetSymbolManager(), *this ).Execute(); } break; } @@ -1760,7 +1760,7 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_FORMULACURSOR: { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); rSet.Put(SfxBoolItem(nWh, pp->GetConfig()->IsShowFormulaCursor())); } break; diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx index 284bc251a3a4..ae633276300f 100644 --- a/svl/source/items/nranges.cxx +++ b/svl/source/items/nranges.cxx @@ -480,7 +480,6 @@ SfxNumRanges& SfxNumRanges::operator -= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; @@ -690,7 +689,6 @@ SfxNumRanges& SfxNumRanges::operator /= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index b7422c56224b..cc033bc6905e 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -151,40 +151,44 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : rFlags |= TransliterationModules_IGNORE_CASE; if ( aOpt.IsMatchFullHalfWidthForms()) rFlags |= TransliterationModules_IGNORE_WIDTH; - if ( aOpt.IsMatchHiraganaKatakana()) - rFlags |= TransliterationModules_IGNORE_KANA; - if ( aOpt.IsMatchContractions()) - rFlags |= TransliterationModules_ignoreSize_ja_JP; - if ( aOpt.IsMatchMinusDashChoon()) - rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; - if ( aOpt.IsMatchRepeatCharMarks()) - rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; - if ( aOpt.IsMatchVariantFormKanji()) - rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; - if ( aOpt.IsMatchOldKanaForms()) - rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; - if ( aOpt.IsMatchDiziDuzu()) - rFlags |= TransliterationModules_ignoreZiZu_ja_JP; - if ( aOpt.IsMatchBavaHafa()) - rFlags |= TransliterationModules_ignoreBaFa_ja_JP; - if ( aOpt.IsMatchTsithichiDhizi()) - rFlags |= TransliterationModules_ignoreTiJi_ja_JP; - if ( aOpt.IsMatchHyuiyuByuvyu()) - rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; - if ( aOpt.IsMatchSesheZeje()) - rFlags |= TransliterationModules_ignoreSeZe_ja_JP; - if ( aOpt.IsMatchIaiya()) - rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; - if ( aOpt.IsMatchKiku()) - rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; - if ( aOpt.IsIgnorePunctuation()) - rFlags |= TransliterationModules_ignoreSeparator_ja_JP; - if ( aOpt.IsIgnoreWhitespace()) - rFlags |= TransliterationModules_ignoreSpace_ja_JP; - if ( aOpt.IsIgnoreProlongedSoundMark()) - rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; - if ( aOpt.IsIgnoreMiddleDot()) - rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; + if ( bAsianOptions ) + { + if ( aOpt.IsMatchHiraganaKatakana()) + rFlags |= TransliterationModules_IGNORE_KANA; + if ( aOpt.IsMatchContractions()) + rFlags |= TransliterationModules_ignoreSize_ja_JP; + if ( aOpt.IsMatchMinusDashChoon()) + rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; + if ( aOpt.IsMatchRepeatCharMarks()) + rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; + if ( aOpt.IsMatchVariantFormKanji()) + rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; + if ( aOpt.IsMatchOldKanaForms()) + rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; + if ( aOpt.IsMatchDiziDuzu()) + rFlags |= TransliterationModules_ignoreZiZu_ja_JP; + if ( aOpt.IsMatchBavaHafa()) + rFlags |= TransliterationModules_ignoreBaFa_ja_JP; + if ( aOpt.IsMatchTsithichiDhizi()) + rFlags |= TransliterationModules_ignoreTiJi_ja_JP; + if ( aOpt.IsMatchHyuiyuByuvyu()) + rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; + if ( aOpt.IsMatchSesheZeje()) + rFlags |= TransliterationModules_ignoreSeZe_ja_JP; + if ( aOpt.IsMatchIaiya()) + rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; + if ( aOpt.IsMatchKiku()) + rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; + if ( aOpt.IsIgnorePunctuation()) + rFlags |= TransliterationModules_ignoreSeparator_ja_JP; + if ( aOpt.IsIgnoreWhitespace()) + rFlags |= TransliterationModules_ignoreSpace_ja_JP; + if ( aOpt.IsIgnoreProlongedSoundMark()) + rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; + if ( aOpt.IsIgnoreMiddleDot()) + rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; + } + } // ----------------------------------------------------------------------- diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index e328a39a0707..be037a1ca3cc 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -1332,17 +1332,38 @@ {\ MenuItem\ {\ - Identifier = SID_TRANSLITERATE_UPPER ; \ - Command = ".uno:ChangeCaseToUpper" ; \ - HelpID = SID_TRANSLITERATE_UPPER ; \ - Text [ en-US ] = "~Uppercase";\ + Identifier = SID_TRANSLITERATE_SENTENCE_CASE; \ + Command = ".uno:ChangeCaseToSentenceCase" ; \ + HelpID = SID_TRANSLITERATE_SENTENCE_CASE; \ + Text [ en-US ] = "~Sentence case";\ };\ MenuItem\ {\ Identifier = SID_TRANSLITERATE_LOWER; \ Command = ".uno:ChangeCaseToLower" ; \ HelpID = SID_TRANSLITERATE_LOWER; \ - Text [ en-US ] = "~Lowercase";\ + Text [ en-US ] = "~lowercase";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_UPPER ; \ + Command = ".uno:ChangeCaseToUpper" ; \ + HelpID = SID_TRANSLITERATE_UPPER ; \ + Text [ en-US ] = "~UPPERCASE";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_TITLE_CASE; \ + Command = ".uno:ChangeCaseToTitleCase" ; \ + HelpID = SID_TRANSLITERATE_TITLE_CASE; \ + Text [ en-US ] = "~Capitalize Every Word";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_TOGGLE_CASE; \ + Command = ".uno:ChangeCaseToToggleCase" ; \ + HelpID = SID_TRANSLITERATE_TOGGLE_CASE; \ + Text [ en-US ] = "~tOGGLE cASE";\ };\ MenuItem\ {\ diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index 6d9153818cde..1f6fe1538a85 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -278,6 +278,7 @@ #define HID_SVX_SENDMENU_SIGNANDENCRYPT (HID_SVX_START + 245) #define HID_SVX_TP_APPEARANCE (HID_SVX_START + 246) #define HID_SVX_TP_DESKTOP (HID_SVX_START + 247) +#define HID_CT_THES_ALTERNATIVES (HID_SVX_START + 248) // please adjust ACT_SVX_HID_END2 below if you add entries here! @@ -285,7 +286,7 @@ // Overrun check --------------------------------------------------------- // ----------------------------------------------------------------------- -#define ACT_SVX_HID_END (HID_SVX_START+247) +#define ACT_SVX_HID_END (HID_SVX_START+248) #if ACT_SVX_HID_END > HID_SVX_END #error Resource-Ueberlauf in #line, #file #endif diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index d193652b57fc..d193652b57fc 100644..100755 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index ddd4ee17ee72..7a90b5c75526 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -383,6 +383,7 @@ #define FN_INSERT_HARD_SPACE (FN_INSERT + 44) /* hard space */ #define FN_INSERT_HARDHYPHEN (FN_INSERT + 85) /* hyphen withou break*/ +//!! be aware to not overwrite something that is used in sw/inc/cmdid.h already !! #define FN_FORMAT (SID_SW_START + 400) #define FN_SET_JUSTIFY_PARA (FN_FORMAT + 21) #define FN_FORMAT_RESET (FN_FORMAT + 69) @@ -1239,6 +1240,7 @@ #define SID_TABLE_STYLE_SETTINGS (SID_SVX_START+1089) #define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090) #define SID_RECHECK_DOCUMENT (SID_SVX_START+1091) + #define SID_OBJECT_MIRROR (SID_SVX_START+1093) #define SID_DELETE_POSTIT (SID_SVX_START+1094) @@ -1250,8 +1252,12 @@ #define SID_DELETEALLBYAUTHOR_POSTIT (SID_SVX_START+1100) #define SID_INSERT_POSTIT (SID_SVX_START+1101) +#define SID_TRANSLITERATE_SENTENCE_CASE (SID_SVX_START+1102) +#define SID_TRANSLITERATE_TITLE_CASE (SID_SVX_START+1103) +#define SID_TRANSLITERATE_TOGGLE_CASE (SID_SVX_START+1104) + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE SID_INSERT_POSTIT + 1 +#define SID_SVX_FIRSTFREE (SID_TRANSLITERATE_TOGGLE_CASE + 1) // -------------------------------------------------------------------------- // Overflow check for slot IDs diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx new file mode 100644 index 000000000000..aec07042e1fc --- /dev/null +++ b/svx/inc/tbunosearchcontrollers.hxx @@ -0,0 +1,282 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __TBUNOSEARCHCONTROLLERS_HXX_ +#define __TBUNOSEARCHCONTROLLERS_HXX_ + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <comphelper/sequenceasvector.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weak.hxx> +#include <svtools/toolboxcontroller.hxx> +#include <vcl/combobox.hxx> +#include <vcl/window.hxx> + +#include <map> + +namespace css = ::com::sun::star ; +namespace svx +{ + +class FindTextFieldControl : public ComboBox +{ +public: + FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FindTextFieldControl(); + + virtual void Modify(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void InitControls_Impl(); + void Remember_Impl(const String& rStr); + +private: + + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; + sal_Bool m_bToClearTextField; + +}; + +class SearchToolbarControllersManager +{ +public: + + SearchToolbarControllersManager(); + ~SearchToolbarControllersManager(); + + static SearchToolbarControllersManager* createControllersManager(); + + void registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ); + void freeController ( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ); + css::uno::Reference< css::frame::XStatusListener > findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ); + +private: + + static SearchToolbarControllersManager* m_pInstance; + + typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec; + typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap; + SearchToolbarControllersMap aSearchToolbarControllersMap; + +}; + +class FindTextToolbarController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + ~FindTextToolbarController(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.FindTextToolboxController" )); + } + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException ); + + DECL_LINK(EditModifyHdl, void*); + +private: + + FindTextFieldControl* m_pFindTextFieldControl; + + USHORT m_nDownSearchId; // item position of findbar + USHORT m_nUpSearchId; // item position of findbar + +}; + +class DownSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + DownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + ~DownSearchToolboxController(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.DownSearchToolboxController" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + +}; + +class UpSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ); + ~UpSearchToolboxController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.UpSearchToolboxController" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + +}; + +// protocol handler for "vnd.sun.star.findbar:*" URLs +// The dispatch object will be used for shortcut commands for findbar +class FindbarDispatcher : public css::lang::XServiceInfo, + public css::lang::XInitialization, + public css::frame::XDispatchProvider, + public css::frame::XDispatch, + public ::cppu::OWeakObject +{ +public: + + FindbarDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~FindbarDispatcher(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.Impl.FindbarDispatcher" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + +private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::frame::XFrame > m_xFrame; + +}; + +// createInstance +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); + +} + +#endif // __TBUNOSEARCHCONTROLLERS_HXX_ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index de4c85dfdd8f..240ca9cbd4e1 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -1455,6 +1455,81 @@ SfxVoidItem ChangeCaseToKatakana SID_TRANSLITERATE_KATAGANA ] //-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToSentenceCase SID_TRANSLITERATE_SENTENCE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToTitleCase SID_TRANSLITERATE_TITLE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToToggleCase SID_TRANSLITERATE_TOGGLE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- SfxVoidItem ChangeCaseToLower SID_TRANSLITERATE_LOWER () [ @@ -10834,7 +10909,7 @@ SdrTextFitToSizeTypeItem TextFitToSize SID_ATTR_TEXT_FITTOSIZE ] //-------------------------------------------------------------------------- -SfxVoidItem Thesaurus SID_THESAURUS +SfxVoidItem ThesaurusDialog SID_THESAURUS () [ /* flags: */ @@ -10843,7 +10918,7 @@ SfxVoidItem Thesaurus SID_THESAURUS FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, diff --git a/svx/source/dialog/makefile.mk b/svx/source/dialog/makefile.mk index 01951caa1471..ac608fae8ec8 100644 --- a/svx/source/dialog/makefile.mk +++ b/svx/source/dialog/makefile.mk @@ -74,6 +74,7 @@ SRC2FILES = \ LIB1TARGET=$(SLB)$/$(TARGET)-core.lib LIB1OBJFILES= \ + $(SLO)$/checklbx.obj \ $(SLO)$/dialmgr.obj\ $(SLO)$/dlgutil.obj \ $(SLO)$/framelink.obj\ @@ -86,7 +87,6 @@ LIB2TARGET=$(SLB)$/$(TARGET).lib LIB2OBJFILES= \ $(SLO)$/charmap.obj \ - $(SLO)$/checklbx.obj \ $(SLO)$/connctrl.obj \ $(SLO)$/contwnd.obj \ $(SLO)$/ctredlin.obj \ diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk index 9b08caa587aa..73a178d97594 100644 --- a/svx/source/tbxctrls/makefile.mk +++ b/svx/source/tbxctrls/makefile.mk @@ -61,7 +61,8 @@ LIB2OBJFILES= \ $(SLO)$/verttexttbxctrl.obj \ $(SLO)$/subtoolboxcontrol.obj \ $(SLO)$/tbxcolor.obj \ - $(SLO)$/tbunocontroller.obj + $(SLO)$/tbunocontroller.obj \ + $(SLO)$/tbunosearchcontrollers.obj SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx new file mode 100644 index 000000000000..f4f03170a90f --- /dev/null +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -0,0 +1,867 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include "tbunosearchcontrollers.hxx" + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/util/URL.hpp> + +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> + +namespace svx +{ + +static const ::rtl::OUString SEARCHITEM_SEARCHSTRING = ::rtl::OUString::createFromAscii("SearchItem.SearchString"); +static const ::rtl::OUString SEARCHITEM_SEARCHBACKWARD = ::rtl::OUString::createFromAscii("SearchItem.Backward"); + +static const ::rtl::OUString COMMAND_EXECUTESEARCH = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); +static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText") ; +static const ::rtl::OUString COMMAND_DOWNSEARCH = ::rtl::OUString::createFromAscii(".uno:DownSearch"); +static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch") ; +static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory"); + +static const ::rtl::OUString SERVICENAME_URLTRANSFORMER = ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer"); +static const sal_Int32 REMEMBER_SIZE = 10; + +void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) +{ + css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); + if ( xURLTransformer.is() ) + { + css::util::URL aURL; + aURL.Complete = COMMAND_EXECUTESEARCH; + xURLTransformer->parseStrict(aURL); + + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + { + css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + if ( xDispatch.is() && aURL.Complete.getLength() > 0 ) + xDispatch->dispatch( aURL, lArgs ); + } + } +} + +FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) : + ComboBox( pParent, nStyle ), + m_xFrame(xFrame), + m_xServiceManager(xServiceManager), + m_bToClearTextField(sal_True) +{ + InitControls_Impl(); +} + +FindTextFieldControl::~FindTextFieldControl() +{ +} + +void FindTextFieldControl::InitControls_Impl() +{ + SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); + SetControlForeground(COL_GRAY); + + EnableAutocomplete(TRUE, TRUE); +} + +void FindTextFieldControl::Remember_Impl(const String& rStr) +{ + USHORT nCount = GetEntryCount(); + + for (USHORT i=0; i<nCount; ++i) + { + if ( rStr == GetEntry(i)) + return; + } + + if (nCount == REMEMBER_SIZE) + RemoveEntry(REMEMBER_SIZE-1); + + InsertEntry(rStr, 0); +} + +void FindTextFieldControl::Modify() +{ + ComboBox::Modify(); + + SetControlForeground( Color( COL_BLACK ) ); +} + +long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) +{ + long nRet= ComboBox::PreNotify( rNEvt ); + + switch ( rNEvt.GetType() ) + { + case EVENT_KEYINPUT: + { + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1(); + sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2(); + sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift(); + sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); + + if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode ) + GrabFocusToDocument(); + + if ( KEY_RETURN == nCode ) + { + Remember_Impl(GetText()); + + ::rtl::OUString sFindText = GetText(); + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + if (bShift) + lArgs[1].Value <<= sal_True; + else + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + } + break; + } + + case EVENT_GETFOCUS: + if ( m_bToClearTextField ) + { + SetText( String() ); + m_bToClearTextField = sal_False; + } + SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); + break; + + case EVENT_LOSEFOCUS: + if ( GetText().Len() == 0 ) + { + SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); + SetControlForeground(COL_GRAY); + m_bToClearTextField = sal_True; + } + break; + } + + return nRet; +} + + +//----------------------------------------------------------------------------------------------------------- +// SearchToolbarControllersManager + +SearchToolbarControllersManager* SearchToolbarControllersManager::m_pInstance = 0; + +SearchToolbarControllersManager::SearchToolbarControllersManager() +{ +} + +SearchToolbarControllersManager::~SearchToolbarControllersManager() +{ +} + +SearchToolbarControllersManager* SearchToolbarControllersManager::createControllersManager() +{ + if (!m_pInstance) + m_pInstance = new SearchToolbarControllersManager(); + + return m_pInstance; +} + +void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ) +{ + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt == aSearchToolbarControllersMap.end()) + { + SearchToolbarControllersVec lControllers(1); + lControllers[0].Name = sCommandURL; + lControllers[0].Value <<= xStatusListener; + aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers)); + } + else + { + sal_Int32 nSize = pIt->second.size(); + for (sal_Int32 i=0; i<nSize; ++i) + { + if (pIt->second[i].Name.equals(sCommandURL)) + return; + } + + pIt->second.resize(nSize+1); + pIt->second[nSize].Name = sCommandURL; + pIt->second[nSize].Value <<= xStatusListener; + } +} + +void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL ) +{ + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pIt->second.erase(pItCtrl); + break; + } + } + + if (pIt->second.empty()) + aSearchToolbarControllersMap.erase(pIt); + } +} + +css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManager::findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ) +{ + css::uno::Reference< css::frame::XStatusListener > xStatusListener; + + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pItCtrl->Value >>= xStatusListener; + break; + } + } + } + + return xStatusListener; +} + +//----------------------------------------------------------------------------------------------------------- +// FindTextToolbarController + +FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_FINDTEXT ) +{ +} + +FindTextToolbarController::~FindTextToolbarController() +{ +} + +// XInterface +css::uno::Any SAL_CALL FindTextToolbarController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL FindTextToolbarController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL FindTextToolbarController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL FindTextToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > FindTextToolbarController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; +} + +// XComponent +void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); + delete m_pFindTextFieldControl; + m_pFindTextFieldControl = 0; +} + +// XInitialization +void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException) +{ + svt::ToolboxController::initialize(aArguments); + + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_DOWNSEARCH ) ) + m_nDownSearchId = i; + else if (sItemCommand.equals( COMMAND_UPSEARCH )) + m_nUpSearchId = i; + } + } + + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL FindTextToolbarController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ +} + +css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ) +{ + css::uno::Reference< css::awt::XWindow > xItemWindow; + + css::uno::Reference< css::awt::XWindow > xParent( Parent ); + Window* pParent = VCLUnoHelper::GetWindow( xParent ); + if ( pParent ) + { + ToolBox* pToolbar = ( ToolBox* )pParent; + m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager ); + + Size aSize(100, m_pFindTextFieldControl->GetTextHeight() + 200); + m_pFindTextFieldControl->SetSizePixel( aSize ); + m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl)); + } + xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl ); + + return xItemWindow; +} + +// XStatusListener +void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; + + ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete; + if (aFeatureURL.equalsAscii("AppendSearchHistory")) + { + m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText()); + } +} + +IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG ) +{ + // enable or disable item DownSearch/UpSearch of findbar + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox && m_pFindTextFieldControl ) + { + if (m_pFindTextFieldControl->GetText().Len()>0) + { + if ( !pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_True); + if ( !pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_True); + } + else + { + if ( pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_False); + if ( pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_False); + } + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------- +// class DownSearchToolboxController + +DownSearchToolboxController::DownSearchToolboxController(const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) + : svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_DOWNSEARCH ) +{ +} + +DownSearchToolboxController::~DownSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL DownSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL DownSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL DownSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL DownSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL DownSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL DownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > DownSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; +} + +// XComponent +void SAL_CALL DownSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL DownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL DownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException) +{ + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) + xStatusListener->statusChanged( aEvent ); +} + +// XStatusListener +void SAL_CALL DownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; +} + +//----------------------------------------------------------------------------------------------------------- +// class UpSearchToolboxController + +UpSearchToolboxController::UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_UPSEARCH ) +{ +} + +UpSearchToolboxController::~UpSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL UpSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL UpSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL UpSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL UpSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL UpSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL UpSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > UpSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; +} + +// XComponent +void SAL_CALL UpSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL UpSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL UpSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_True; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) + xStatusListener->statusChanged( aEvent ); +} + +// XStatusListener +void SAL_CALL UpSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; +} + +//----------------------------------------------------------------------------------------------------------- +// class FindbarDispatcher + +FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory) + : m_xFactory( xFactory ) +{ +} + +FindbarDispatcher::~FindbarDispatcher() +{ + m_xFactory = NULL; + m_xFrame = NULL; +} + +// XInterface +css::uno::Any SAL_CALL FindbarDispatcher::queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ) +{ + css::uno::Any aReturn( ::cppu::queryInterface( aType, + static_cast< css::lang::XServiceInfo* >(this), + static_cast< css::lang::XInitialization* >(this), + static_cast< css::frame::XDispatchProvider* >(this), + static_cast< css::frame::XDispatch* >(this)) ); + + if ( aReturn.hasValue() ) + return aReturn; + + return OWeakObject::queryInterface( aType ); +} + +void SAL_CALL FindbarDispatcher::acquire() throw() +{ + OWeakObject::acquire(); +} + +void SAL_CALL FindbarDispatcher::release() throw() +{ + OWeakObject::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL FindbarDispatcher::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + return ( + ServiceName.equalsAscii("com.sun.star.comp.svx.FindbarDispatcher") || + ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler") + ); +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" )); + aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" )); + return aSNS; +} + +// XInitialization +void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + if ( aArguments.getLength() ) + aArguments[0] >>= m_xFrame; +} + +// XDispatchProvider +css::uno::Reference< css::frame::XDispatch > SAL_CALL FindbarDispatcher::queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException ) +{ + css::uno::Reference< css::frame::XDispatch > xDispatch; + + if ( aURL.Protocol.equalsAscii("vnd.sun.star.findbar:") ) + xDispatch = this; + + return xDispatch; +} + +css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL FindbarDispatcher::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException ) +{ + sal_Int32 nCount = seqDescripts.getLength(); + css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount ); + + for( sal_Int32 i=0; i<nCount; ++i ) + lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags ); + + return lDispatcher; +} + +// XDispatch +void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ ) throw( css::uno::RuntimeException ) +{ + //vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar + if ( aURL.Path.equalsAscii("FocusToFindbar") ) + { + css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY); + if(!xPropSet.is()) + return; + + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ); + aValue >>= xLayoutManager; + if (!xLayoutManager.is()) + return; + + const ::rtl::OUString sResourceURL = ::rtl::OUString::createFromAscii("private:resource/toolbar/findbar"); + css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); + if (!xUIElement.is()) + return; + + css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equalsAscii(".uno:FindText") ) + { + Window* pItemWin = pToolBox->GetItemWindow( i ); + if ( pItemWin ) + { + pItemWin->GrabFocus(); + return; + } + } + } + } + + } +} + +void SAL_CALL FindbarDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) +{ +} + +void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) +{ +} + +//----------------------------------------------------------------------------------------------------------- +// create Instance + +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new FindTextToolbarController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new DownSearchToolboxController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new UpSearchToolboxController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new FindbarDispatcher( rSMgr ); +} + +//----------------------------------------------------------------------------------------------------------- +} diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 8b4351cc8df0..bf7a848d71c6 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -39,6 +39,7 @@ #include "recoveryui.hxx" #include "xmlgrhlp.hxx" #include "tbunocontroller.hxx" +#include "tbunosearchcontrollers.hxx" using namespace ::com::sun::star; using namespace ::rtl; @@ -288,6 +289,12 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, svx::RecoveryUI::st_getImplementationName(), svx::RecoveryUI::st_getSupportedServiceNames() ); writeInfo( pKey, svx::GraphicExporter_getImplementationName(), svx::GraphicExporter_getSupportedServiceNames() ); writeInfo( pKey, svx::FontHeightToolBoxControl::getImplementationName_Static(), svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); + + writeInfo( pKey, svx::FindTextToolbarController::getImplementationName_Static(), svx::FindTextToolbarController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::DownSearchToolboxController::getImplementationName_Static(), svx::DownSearchToolboxController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::UpSearchToolboxController::getImplementationName_Static(), svx::UpSearchToolboxController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::FindbarDispatcher::getImplementationName_Static(), svx::FindbarDispatcher::getSupportedServiceNames_Static() ); + writeInfo( pKey, ::unogallery::GalleryThemeProvider_getImplementationName(),::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); // XPrimitiveFactory2D @@ -358,6 +365,34 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::FontHeightToolBoxControl_createInstance, svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); } + else if ( svx::FindTextToolbarController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::FindTextToolbarController::getImplementationName_Static(), + svx::FindTextToolbarController_createInstance, + svx::FindTextToolbarController::getSupportedServiceNames_Static() ); + } + else if ( svx::DownSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::DownSearchToolboxController::getImplementationName_Static(), + svx::DownSearchToolboxController_createInstance, + svx::DownSearchToolboxController::getSupportedServiceNames_Static() ); + } + else if ( svx::UpSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::UpSearchToolboxController::getImplementationName_Static(), + svx::UpSearchToolboxController_createInstance, + svx::UpSearchToolboxController::getSupportedServiceNames_Static() ); + } + else if ( svx::FindbarDispatcher::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::FindbarDispatcher::getImplementationName_Static(), + svx::FindbarDispatcher_createInstance, + svx::FindbarDispatcher::getSupportedServiceNames_Static() ); + } else if( ::unogallery::GalleryThemeProvider_getImplementationName().equalsAscii( pImplName ) ) { xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 3adc03dc13a5..a206392aad3b 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -717,7 +717,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr --------------------------------------------------------------------*/ #define FN_LINE_NUMBERING_DLG (FN_EXTRA + 2 ) /* Zeilennumerierung */ -#define FN_THESAURUS_DLG (FN_EXTRA + 3 ) /* Thesaurus */ #define FN_HYPHENATE_OPT_DLG (FN_EXTRA + 5 ) /* Silbentrennung */ #define FN_ADD_UNKNOWN (FN_EXTRA + 6 ) /* Woerter lernen */ #define FN_DICTIONARY_DLG (FN_EXTRA + 8 ) /* Woerterbuecher */ diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index bcf511aa2a5b..fe77e94627d7 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -27,6 +27,8 @@ #ifndef _CRSRSH_HXX #define _CRSRSH_HXX +#include <com/sun/star/i18n/WordType.hpp> + #include <tools/string.hxx> #include <tools/link.hxx> #include <tools/rtti.hxx> @@ -748,9 +750,9 @@ public: BOOL SelectWord( const Point* pPt = 0 ); // Position vom akt. Cursor erfragen - BOOL IsStartWord()const; - BOOL IsEndWord() const; - BOOL IsInWord() const; + BOOL IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES )const; + BOOL IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + BOOL IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; BOOL IsStartSentence() const; BOOL IsEndSentence() const; BOOL IsSttPara() const; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index d433ff603b2f..adead2ed45e4 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -716,6 +716,7 @@ private: bool DeleteAndJoinImpl(SwPaM&, const bool); bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false); bool DeleteRangeImpl(SwPaM&, const bool unused = false); + bool DeleteRangeImplImpl(SwPaM &); bool ReplaceRangeImpl(SwPaM&, String const&, const bool); public: diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 8d2c1a81de49..f247422c089d 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -201,6 +201,7 @@ public: // change text to Upper/Lower/Hiragana/Katagana/... void TransliterateText( sal_uInt32 nType ); + void TransliterateText( const String& rModuleName ); // count words in current selection void CountWords( SwDocStat& rStat ) const; diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index a39dcefaabd3..a2e08366ba24 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -305,12 +305,17 @@ inline void SwFieldType::UpdateFlds() const class SW_DLLPUBLIC SwField { +private: + mutable String m_Cache; /// #i85766# cached expansion (for clipboard) USHORT nLang; // Immer ueber SetLanguage aendern! BOOL bIsAutomaticLanguage; sal_uInt32 nFormat; SwFieldType* pType; + virtual String Expand() const = 0; + virtual SwField* Copy() const = 0; + protected: void SetFormat(sal_uInt32 nSet) {nFormat = nSet;} @@ -325,12 +330,16 @@ public: // neuen Typ setzen (wird fuer das Kopieren zwischen Dokumenten benutzt) virtual SwFieldType* ChgTyp( SwFieldType* ); - // Expandierung fuer die Anzeige - virtual String Expand() const = 0; + /** expand the field. + @param bInClipboard field is in clipboard document? + @return the generated text (suitable for display) + */ + String ExpandField(bool const bInClipboard) const; // liefert den Namen oder den Inhalt virtual String GetCntnt(BOOL bName = FALSE) const; - virtual SwField* Copy() const = 0; + + SwField * CopyField() const; // ResId USHORT Which() const diff --git a/sw/inc/htmltbl.hxx b/sw/inc/htmltbl.hxx index 941e6bc43eb2..ef16a2a89b86 100644 --- a/sw/inc/htmltbl.hxx +++ b/sw/inc/htmltbl.hxx @@ -267,6 +267,7 @@ class SwHTMLTableLayout DECL_STATIC_LINK( SwHTMLTableLayout, DelayedResize_Impl, void* ); + static USHORT GetBrowseWidthByVisArea( const SwDoc& rDoc ); public: SwHTMLTableLayout( const SwTable *pSwTbl, @@ -348,7 +349,6 @@ public: // oder eine ViewShell vorhanden ist. Sonst wird 0 zurueckgegeben. // (Wird vom HTML-Filter benoetigt, da der nicht an das Layout kommt.) static USHORT GetBrowseWidth( const SwDoc& rDoc ); - static USHORT GetBrowseWidthByVisArea( const SwDoc& rDoc ); // Ermitteln der verfuegbaren Breite uber den Tabellen-Frame USHORT GetBrowseWidthByTabFrm( const SwTabFrm& rTabFrm ) const; diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index cf3a4a779487..53168d5a9cb4 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _NDTXT_HXX -#define _NDTXT_HXX +#ifndef SW_NDTXT_HXX +#define SW_NDTXT_HXX #include <cppuhelper/weakref.hxx> @@ -133,6 +133,8 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable // pointer to the list, to whose the text node is added to SwList* mpList; // <-- + /// #i111677# cached expansion (for clipboard) + ::std::auto_ptr< ::rtl::OUString > m_pNumStringCache; ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XTextContent> m_wXParagraph; diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 6e26a6a3bfcb..d33c745524c1 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -26,7 +26,9 @@ ************************************************************************/ #ifndef _SWCRSR_HXX #define _SWCRSR_HXX + #include <com/sun/star/i18n/WordType.hpp> + #include <pam.hxx> #include <tblsel.hxx> #include <cshtyp.hxx> @@ -129,10 +131,10 @@ public: const SfxItemSet* rReplSet = 0 ); // UI versions - BOOL IsStartWord() const; - BOOL IsEndWord() const; + BOOL IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + BOOL IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + BOOL IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; BOOL IsStartEndSentence( bool bEnd ) const; - BOOL IsInWord() const; BOOL GoStartWord(); BOOL GoEndWord(); BOOL GoNextWord(); diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx index 1daff7d2e914..d0be4a008cab 100644 --- a/sw/inc/txtfld.hxx +++ b/sw/inc/txtfld.hxx @@ -41,7 +41,8 @@ class SwTxtFld : public SwTxtAttr SwTxtNode * m_pTxtNode; public: - SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStart ); + SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart, + bool const bInClipboard); virtual ~SwTxtFld(); void CopyFld( SwTxtFld *pDest ) const; diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx index 0b55053d03dd..07043a9263bc 100644 --- a/sw/inc/txtftn.hxx +++ b/sw/inc/txtftn.hxx @@ -49,7 +49,7 @@ public: inline SwNodeIndex *GetStartNode() const { return m_pStartNode; } void SetStartNode( const SwNodeIndex *pNode, BOOL bDelNodes = TRUE ); void SetNumber( const USHORT nNumber, const String* = 0 ); - void CopyFtn( SwTxtFtn *pDest ) const; + void CopyFtn(SwTxtFtn & rDest, SwTxtNode & rDestNode) const; // get and set TxtNode pointer inline const SwTxtNode& GetTxtNode() const; diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index f0036e7abf35..8d37888ea789 100644..100755 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -41,7 +41,7 @@ class ViewShell; class SwDocShell; namespace svtools{ class ColorConfig;} -#define VIEWOPT_1_IDLE 0x00000001L +//#define VIEWOPT_1_IDLE 0x00000001L no longer used, see new member 'bIdle' #define VIEWOPT_1_TAB 0x00000002L #define VIEWOPT_1_BLANK 0x00000004L #define VIEWOPT_1_HARDBLANK 0x00000008L @@ -164,6 +164,7 @@ protected: BOOL bBookview : 1; // view mode for page preview BOOL mbViewLayoutBookMode : 1; // book view mode for edit view sal_Bool bShowPlaceHolderFields : 1; //only used in printing! + mutable bool bIdle; // Maszstab USHORT nZoom; // Angaben in Prozent @@ -202,9 +203,14 @@ public: ----------------------------------------------------------------------------*/ inline BOOL IsIdle() const - { return nCoreOptions & VIEWOPT_1_IDLE ? TRUE : FALSE; } - inline void SetIdle( BOOL b ) - { (b != 0) ? (nCoreOptions |= VIEWOPT_1_IDLE ) : ( nCoreOptions &= ~VIEWOPT_1_IDLE); } + { return bIdle; } + + // logically this is a const function since it does not modify the viewoptions + // but only effects idle formatting. Of course that member is already implement + // in the wrong place here... Also currently there are many const modifying casts in the code + // just to call this function on otherwise const objects. Thus declaring it as const now. + inline void SetIdle( BOOL b ) const + { bIdle = b; } inline BOOL IsTab(BOOL bHard = FALSE) const { return !bReadonly && (nCoreOptions & VIEWOPT_1_TAB) && diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 012ebbd5e68c..e264aec28c28 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1485,6 +1485,24 @@ interface BaseText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TITLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TOGGLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecTransliteration; @@ -1585,6 +1603,12 @@ interface BaseText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents ] + SID_THES + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents + ] } //ende interface text diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index b45e4a305328..ee5fc431e165 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -398,7 +398,7 @@ interface BaseTextEditView ExecMethod = Execute ; StateMethod = GetState ; ] - FN_THESAURUS_DLG // status(final|play) + SID_THESAURUS // status(final|play) [ ExecMethod = ExecLingu ; StateMethod = GetState ; diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi index 441beec686c6..349e17b9d985 100755 --- a/sw/sdi/annotsh.sdi +++ b/sw/sdi/annotsh.sdi @@ -31,7 +31,7 @@ interface Annotation : _Annotation ] { - FN_THESAURUS_DLG // api: + SID_THESAURUS // api: [ ExecMethod = ExecLingu ; StateMethod = GetLinguState ; @@ -178,6 +178,27 @@ interface Annotation : _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_TRANSLITERATE_TITLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_TRANSLITERATE_TOGGLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_UPPER [ ExecMethod = ExecTransliteration; @@ -344,6 +365,13 @@ interface Annotation : _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_THES + [ + ExecMethod = ExecLingu ; + StateMethod = GetLinguState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents + ] + } shell SwAnnotationShell diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 6887346ee012..d98d368a9460 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -424,7 +424,7 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_THESAURUS_DLG // api: + SID_THESAURUS // api: [ ExecMethod = ExecDrawLingu ; StateMethod = GetState ; @@ -478,6 +478,24 @@ interface TextDrawText [ StateMethod = StateInsert ; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TITLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TOGGLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecTransliteration; @@ -514,6 +532,7 @@ interface TextDrawText StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_LANGUAGE_STATUS [ ExecMethod = Execute; @@ -521,6 +540,13 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents ] + SID_THES + [ + ExecMethod = Execute; + StateMethod = GetState; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents + ] + FN_FORMAT_FOOTNOTE_DLG // status() [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index aede24688e1e..c27ac20b0013 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -8319,31 +8319,6 @@ SfxVoidItem TextWrap FN_DRAW_WRAP_DLG ] //-------------------------------------------------------------------------- -SfxVoidItem ThesaurusDialog FN_THESAURUS_DLG -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_OPTIONS; -] - -//-------------------------------------------------------------------------- SfxVoidItem ToggleAnchorType FN_TOOL_ANKER () [ diff --git a/sw/sdi/swslots.src b/sw/sdi/swslots.src deleted file mode 100644 index 030fdee2a157..000000000000 --- a/sw/sdi/swslots.src +++ /dev/null @@ -1,1488 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "cmdid.h" -#include "svx/svxids.hrc" -#include "globals.hrc" -SfxSlotInfo FN_ABSTRACT_NEWDOC -{ - Slotname [ en-US ] = "Document From Abstract"; -}; -SfxSlotInfo FN_ABSTRACT_STARIMPRESS -{ - Slotname [ en-US ] = "Presentation from Abstract"; -}; -SfxSlotInfo FN_ADD_UNKNOWN -{ - Slotname [ en-US ] = "Add Unknown Words"; -}; -SfxSlotInfo FN_AUTO_CORRECT -{ - Slotname [ en-US ] = "AutoCorrect"; -}; -SfxSlotInfo FN_AUTOFORMAT_APPLY -{ - Slotname [ en-US ] = "Apply AutoFormat Options"; -}; -SfxSlotInfo FN_AUTOFORMAT_AUTO -{ - Slotname [ en-US ] = "AutoFormat While Typing"; -}; -SfxSlotInfo FN_AUTOFORMAT_REDLINE_APPLY -{ - Slotname [ en-US ] = "Apply AutoFormat Options and confirm Changes"; -}; -SfxSlotInfo FN_BACKSPACE -{ - Slotname [ en-US ] = "Backspace"; -}; -SfxSlotInfo FN_CALC_TABLE -{ - Slotname [ en-US ] = "Calculate Table"; -}; -SfxSlotInfo FN_CALCULATE -{ - Slotname [ en-US ] = "Calculate Selection"; -}; -SfxSlotInfo FN_CHANGE_DBFIELD -{ - Slotname [ en-US ] = "Change Database"; -}; -SfxSlotInfo FN_CHANGE_PAGENUM -{ - Slotname [ en-US ] = "Page Number"; -}; -SfxSlotInfo FN_CHAR_LEFT -{ - Slotname [ en-US ] = "To Character Left"; -}; -SfxSlotInfo FN_CHAR_LEFT_SEL -{ - Slotname [ en-US ] = "Select Character Left"; -}; -SfxSlotInfo FN_CHAR_RIGHT -{ - Slotname [ en-US ] = "Go Right"; -}; -SfxSlotInfo FN_CHAR_RIGHT_SEL -{ - Slotname [ en-US ] = "Select Character Right"; -}; -SfxSlotInfo FN_CNTNT_TO_NEXT_FRAME -{ - Slotname [ en-US ] = "To Next Frame"; -}; -SfxSlotInfo FN_CONVERT_TEXT_TABLE -{ - Slotname [ en-US ] = "Convert Table/Text"; -}; -SfxSlotInfo FN_DEC_INDENT_OFFSET -{ - Slotname [ en-US ] = "Decrement Indent Value"; -}; -SfxSlotInfo FN_DELETE_BACK_LINE -{ - Slotname [ en-US ] = "Delete to Start of Line"; -}; -SfxSlotInfo FN_DELETE_BACK_PARA -{ - Slotname [ en-US ] = "Delete to Start of Paragraph"; -}; -SfxSlotInfo FN_DELETE_BACK_SENT -{ - Slotname [ en-US ] = "Delete to Start of Sentence"; -}; -SfxSlotInfo FN_DELETE_BACK_WORD -{ - Slotname [ en-US ] = "Delete to Start of Word"; -}; -SfxSlotInfo FN_DELETE_LINE -{ - Slotname [ en-US ] = "Delete to End of Line"; -}; -SfxSlotInfo FN_DELETE_PARA -{ - Slotname [ en-US ] = "Delete to End of Paragraph"; -}; -SfxSlotInfo FN_DELETE_SENT -{ - Slotname [ en-US ] = "Delete to End of Sentence"; -}; -SfxSlotInfo FN_DELETE_WHOLE_LINE -{ - Slotname [ en-US ] = "Delete Row"; -}; -SfxSlotInfo FN_DELETE_WORD -{ - Slotname [ en-US ] = "Delete to End of Word"; -}; -SfxSlotInfo FN_DRAW_WRAP_DLG -{ - Slotname [ en-US ] = "Text Wrap"; -}; -SfxSlotInfo FN_DRAWTEXT_ATTR_DLG -{ - Slotname [ en-US ] = "Text Attributes"; -}; -SfxSlotInfo FN_EDIT_FIELD -{ - Slotname [ en-US ] = "Fields"; -}; -SfxSlotInfo FN_EDIT_FOOTNOTE -{ - Slotname [ en-US ] = "Footnote"; -}; -SfxSlotInfo FN_EDIT_FORMULA -{ - Slotname [ en-US ] = "Formula Bar"; -}; -SfxSlotInfo FN_EDIT_IDX_ENTRY_DLG -{ - Slotname [ en-US ] = "Index Entry"; -}; -SfxSlotInfo FN_EDIT_LINK_DLG -{ - Slotname [ en-US ] = "Links"; -}; -SfxSlotInfo FN_EDIT_REGION -{ - Slotname [ en-US ] = "Sections"; -}; -SfxSlotInfo FN_END_DOC_DIRECT -{ - Slotname [ en-US ] = "Directly to Document End"; -}; -SfxSlotInfo FN_END_OF_COLUMN -{ - Slotname [ en-US ] = "To Column End"; -}; -SfxSlotInfo FN_END_OF_DOCUMENT -{ - Slotname [ en-US ] = "To Document End"; -}; -SfxSlotInfo FN_END_OF_DOCUMENT_SEL -{ - Slotname [ en-US ] = "Select to Document End"; -}; -SfxSlotInfo FN_END_OF_LINE -{ - Slotname [ en-US ] = "To End of Line"; -}; -SfxSlotInfo FN_END_OF_LINE_SEL -{ - Slotname [ en-US ] = "Select to End of Line"; -}; -SfxSlotInfo FN_END_OF_NEXT_COLUMN -{ - Slotname [ en-US ] = "To End of Next Column"; -}; -SfxSlotInfo FN_END_OF_NEXT_PAGE -{ - Slotname [ en-US ] = "To End of Next Page"; -}; -SfxSlotInfo FN_END_OF_NEXT_PAGE_SEL -{ - Slotname [ en-US ] = "Select to End of Next Page"; -}; -SfxSlotInfo FN_END_OF_PAGE -{ - Slotname [ en-US ] = "To Page End"; -}; -SfxSlotInfo FN_END_OF_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Page End"; -}; -SfxSlotInfo FN_END_OF_PARA -{ - Slotname [ en-US ] = "To Paragraph End"; -}; -SfxSlotInfo FN_END_OF_PARA_SEL -{ - Slotname [ en-US ] = "Select to Paragraph End"; -}; -SfxSlotInfo FN_END_OF_PREV_COLUMN -{ - Slotname [ en-US ] = "To Previous Column"; -}; -SfxSlotInfo FN_END_OF_PREV_PAGE -{ - Slotname [ en-US ] = "To End of Previous Page"; -}; -SfxSlotInfo FN_END_OF_PREV_PAGE_SEL -{ - Slotname [ en-US ] = "Select to End of Previous Page"; -}; -SfxSlotInfo FN_END_TABLE -{ - Slotname [ en-US ] = "To Table End"; -}; -SfxSlotInfo FN_ENVELOP -{ - Slotname [ en-US ] = "Insert Envelope"; -}; -SfxSlotInfo FN_ESCAPE -{ - Slotname [ en-US ] = "Cancel"; -}; -SfxSlotInfo FN_EXECUTE_MACROFIELD -{ - Slotname [ en-US ] = "Run Macro Field"; -}; -SfxSlotInfo FN_EXPAND_GLOSSARY -{ - Slotname [ en-US ] = "Run AutoText Entry"; -}; -SfxSlotInfo FN_FLIP_HORZ_GRAFIC -{ - Slotname [ en-US ] = "Flip Vertically"; -}; -SfxSlotInfo FN_FLIP_VERT_GRAFIC -{ - Slotname [ en-US ] = "Flip Horizontally"; -}; -SfxSlotInfo FN_FOOTNOTE_TO_ANCHOR -{ - Slotname [ en-US ] = "To Footnote Anchor"; -}; -SfxSlotInfo FN_FORMAT_BACKGROUND_DLG -{ - Slotname [ en-US ] = "Background"; -}; -SfxSlotInfo FN_FORMAT_BORDER_DLG -{ - Slotname [ en-US ] = "Borders"; -}; -SfxSlotInfo FN_FORMAT_DROPCAPS -{ - Slotname [ en-US ] = "Drop Caps"; -}; -SfxSlotInfo FN_FORMAT_FOOTNOTE_DLG -{ - Slotname [ en-US ] = "Footnotes"; -}; -SfxSlotInfo FN_FORMAT_FRAME_DLG -{ - Slotname [ en-US ] = "Frame Properties"; -}; -SfxSlotInfo FN_FORMAT_GRAFIC_DLG -{ - Slotname [ en-US ] = "Edit Graphics"; -}; -SfxSlotInfo FN_FORMAT_PAGE_COLUMN_DLG -{ - Slotname [ en-US ] = "Page Columns"; -}; -SfxSlotInfo FN_FORMAT_PAGE_DLG -{ - Slotname [ en-US ] = "Page Settings"; -}; -SfxSlotInfo FN_FORMAT_RESET -{ - Slotname [ en-US ] = "Reset Font Attributes"; -}; -SfxSlotInfo FN_FORMAT_TABLE_DLG -{ - Slotname [ en-US ] = "Edit Table"; -}; -SfxSlotInfo FN_FRAME_ALIGN_HORZ_CENTER -{ - Slotname [ en-US ] = "Center Horizontal"; -}; -SfxSlotInfo FN_FRAME_ALIGN_HORZ_LEFT -{ - Slotname [ en-US ] = "Align Left"; -}; -SfxSlotInfo FN_FRAME_ALIGN_HORZ_RIGHT -{ - Slotname [ en-US ] = "Align Right"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_BOTTOM -{ - Slotname [ en-US ] = "Align Bottom"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CENTER -{ - Slotname [ en-US ] = "Align Vertical Center"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CHAR_BOTTOM -{ - Slotname [ en-US ] = "Align to Bottom of Character"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CHAR_CENTER -{ - Slotname [ en-US ] = "Align to Vertical Center of Character"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CHAR_TOP -{ - Slotname [ en-US ] = "Align to Top of Character"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_ROW_BOTTOM -{ - Slotname [ en-US ] = "Align to Bottom of Line"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_ROW_CENTER -{ - Slotname [ en-US ] = "Align to Vertical Center of Line"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_ROW_TOP -{ - Slotname [ en-US ] = "Align to Top of Line"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_TOP -{ - Slotname [ en-US ] = "Align Top"; -}; -SfxSlotInfo FN_FRAME_CHAIN -{ - Slotname [ en-US ] = "Link Frames"; -}; -SfxSlotInfo FN_FRAME_DOWN -{ - Slotname [ en-US ] = "Send Backward"; -}; -SfxSlotInfo FN_FRAME_MIRROR_ON_EVEN_PAGES -{ - Slotname [ en-US ] = "Mirror Object on Even Pages"; -}; -SfxSlotInfo FN_FRAME_NOWRAP -{ - Slotname [ en-US ] = "Wrap Off"; -}; -SfxSlotInfo FN_FRAME_TO_ANCHOR -{ - Slotname [ en-US ] = "Set Cursor To Anchor"; -}; -SfxSlotInfo FN_FRAME_UNCHAIN -{ - Slotname [ en-US ] = "Unlink Frames"; -}; -SfxSlotInfo FN_FRAME_UP -{ - Slotname [ en-US ] = "Bring Forward"; -}; -SfxSlotInfo FN_FRAME_WRAP -{ - Slotname [ en-US ] = "Wrap On"; -}; -SfxSlotInfo FN_FRAME_WRAP_CONTOUR -{ - Slotname [ en-US ] = "Wrap Contour On"; -}; -SfxSlotInfo FN_FRAME_WRAP_IDEAL -{ - Slotname [ en-US ] = "Wrap Optimal"; -}; -SfxSlotInfo FN_FRAME_WRAP_LEFT -{ - Slotname [ en-US ] = "Wrap Left"; -}; -SfxSlotInfo FN_FRAME_WRAP_RIGHT -{ - Slotname [ en-US ] = "Wrap Right"; -}; -SfxSlotInfo FN_FRAME_WRAPTHRU -{ - Slotname [ en-US ] = "Wrap Through"; -}; -SfxSlotInfo FN_FRAME_WRAPTHRU_TRANSP -{ - Slotname [ en-US ] = "Wrap Transparent"; -}; -SfxSlotInfo FN_GLOSSARY_DLG -{ - Slotname [ en-US ] = "Edit AutoText"; -}; -SfxSlotInfo FN_GOTO_NEXT_INPUTFLD -{ - Slotname [ en-US ] = "To Next Input Field"; -}; -SfxSlotInfo FN_GOTO_NEXT_MARK -{ - Slotname [ en-US ] = "To Next Placeholder"; -}; -SfxSlotInfo FN_GOTO_NEXT_OBJ -{ - Slotname [ en-US ] = "To Next Object"; -}; -SfxSlotInfo FN_GOTO_NEXT_REGION -{ - Slotname [ en-US ] = "To Next Section"; -}; -SfxSlotInfo FN_GOTO_PREV_INPUTFLD -{ - Slotname [ en-US ] = "To Previous Input Field"; -}; -SfxSlotInfo FN_GOTO_PREV_MARK -{ - Slotname [ en-US ] = "To Previous Placeholder"; -}; -SfxSlotInfo FN_GOTO_PREV_OBJ -{ - Slotname [ en-US ] = "To Previous Object"; -}; -SfxSlotInfo FN_GOTO_PREV_REGION -{ - Slotname [ en-US ] = "To Previous Section"; -}; -SfxSlotInfo FN_GOTO_REFERENCE -{ - Slotname [ en-US ] = "To Reference"; -}; -SfxSlotInfo FN_GRAPHIC_MIRROR_ON_EVEN_PAGES -{ - Slotname [ en-US ] = "Flip Graphics on Even Pages"; -}; -SfxSlotInfo FN_GROW_FONT_SIZE -{ - Slotname [ en-US ] = "Increase Font"; -}; -SfxSlotInfo FN_HSCROLLBAR -{ - Slotname [ en-US ] = "Scroll Horizontal"; -}; -SfxSlotInfo FN_HYPHENATE_OPT_DLG -{ - Slotname [ en-US ] = "Hyphenation"; -}; -SfxSlotInfo FN_IDX_MARK_TO_IDX -{ - Slotname [ en-US ] = "Index Mark to Index"; -}; -SfxSlotInfo FN_INC_INDENT_OFFSET -{ - Slotname [ en-US ] = "Increment Indent Value"; -}; -SfxSlotInfo FN_INSERT_BOOKMARK -{ - Slotname [ en-US ] = "Insert Bookmark"; -}; -SfxSlotInfo FN_INSERT_BREAK -{ - Slotname [ en-US ] = "Insert Paragraph"; -}; -SfxSlotInfo FN_INSERT_BREAK_DLG -{ - Slotname [ en-US ] = "Insert Manual Break"; -}; -SfxSlotInfo FN_INSERT_CAPTION -{ - Slotname [ en-US ] = "Insert Caption"; -}; -SfxSlotInfo FN_INSERT_COLUMN_BREAK -{ - Slotname [ en-US ] = "Insert Column Break"; -}; -SfxSlotInfo FN_INSERT_CTRL -{ - Slotname [ en-US ] = "Insert"; -}; -SfxSlotInfo FN_INSERT_ENDNOTE -{ - Slotname [ en-US ] = "Insert Endnote Directly"; -}; -SfxSlotInfo FN_INSERT_FIELD -{ - Slotname [ en-US ] = "Fields Dialog"; -}; -SfxSlotInfo FN_INSERT_FIELD_CTRL -{ - Slotname [ en-US ] = "Insert Fields"; -}; -SfxSlotInfo FN_INSERT_FLD_AUTHOR -{ - Slotname [ en-US ] = "Insert Author Field"; -}; -SfxSlotInfo FN_INSERT_FLD_DATE -{ - Slotname [ en-US ] = "Insert Date"; -}; -SfxSlotInfo FN_INSERT_FLD_PGCOUNT -{ - Slotname [ en-US ] = "Insert Page Count"; -}; -SfxSlotInfo FN_INSERT_FLD_PGNUMBER -{ - Slotname [ en-US ] = "Insert Page Number"; -}; -SfxSlotInfo FN_INSERT_FLD_TIME -{ - Slotname [ en-US ] = "Insert Time"; -}; -SfxSlotInfo FN_INSERT_FLD_TITLE -{ - Slotname [ en-US ] = "Insert Document Title"; -}; -SfxSlotInfo FN_INSERT_FLD_TOPIC -{ - Slotname [ en-US ] = "Insert Subject"; -}; -SfxSlotInfo FN_INSERT_FOOTNOTE -{ - Slotname [ en-US ] = "Insert Footnote Directly"; -}; -SfxSlotInfo FN_INSERT_FOOTNOTE_DLG -{ - Slotname [ en-US ] = "Insert Footnote"; -}; -SfxSlotInfo FN_INSERT_FRAME -{ - Slotname [ en-US ] = "Insert Frame"; -}; -SfxSlotInfo FN_INSERT_FRAME_INTERACT_NOCOL -{ - Slotname [ en-US ] = "Insert single-column frame manually"; -}; -SfxSlotInfo FN_INSERT_FRAME_INTERACT -{ - Slotname [ en-US ] = "Insert Frame Manually"; -}; -SfxSlotInfo FN_INSERT_HARD_SPACE -{ - Slotname [ en-US ] = "Insert Non-breaking Space"; -}; -SfxSlotInfo FN_INSERT_HARDHYPHEN -{ - Slotname [ en-US ] = "Insert Non-breaking Hyphen"; -}; -SfxSlotInfo FN_INSERT_HRULER -{ - Slotname [ en-US ] = "Insert Horizontal Ruler"; -}; -SfxSlotInfo FN_INSERT_HYPERLINK -{ - Slotname [ en-US ] = "Insert Hyperlink"; -}; -SfxSlotInfo FN_INSERT_IDX_ENTRY_DLG -{ - Slotname [ en-US ] = "Insert Index Marker"; -}; -SfxSlotInfo FN_INSERT_LINEBREAK -{ - Slotname [ en-US ] = "Insert Manual Row Break"; -}; -SfxSlotInfo FN_INSERT_OBJ_CTRL -{ - Slotname [ en-US ] = "Insert Object"; -}; -SfxSlotInfo FN_INSERT_OBJECT_DLG -{ - Slotname [ en-US ] = "Insert Other Objects"; -}; -SfxSlotInfo FN_INSERT_PAGEBREAK -{ - Slotname [ en-US ] = "Insert Manual Page Break"; -}; -SfxSlotInfo FN_INSERT_PAGEFOOTER -{ - Slotname [ en-US ] = "Insert Footer"; -}; -SfxSlotInfo FN_INSERT_PAGEHEADER -{ - Slotname [ en-US ] = "Insert Header"; -}; -SfxSlotInfo FN_INSERT_REF_FIELD -{ - Slotname [ en-US ] = "Insert Field Reference"; -}; -SfxSlotInfo FN_INSERT_REGION -{ - Slotname [ en-US ] = "Insert Section"; -}; -SfxSlotInfo FN_INSERT_SMA -{ - Slotname [ en-US ] = "Insert %PRODUCTNAME Math object"; -}; -SfxSlotInfo FN_INSERT_SOFT_HYPHEN -{ - Slotname [ en-US ] = "Insert Optional Hyphen"; -}; -SfxSlotInfo FN_INSERT_SYMBOL -{ - Slotname [ en-US ] = "Insert Special Character "; -}; -SfxSlotInfo FN_INSERT_TABLE -{ - Slotname [ en-US ] = "Insert Table"; -}; -SfxSlotInfo FN_JAVAEDIT -{ - Slotname [ en-US ] = "Insert Script"; -}; -SfxSlotInfo FN_LABEL -{ - Slotname [ en-US ] = "Insert Labels"; -}; -SfxSlotInfo FN_BUSINESS_CARD -{ - Slotname [ en-US ] = "Insert business cards"; -}; -SfxSlotInfo FN_LINE_DOWN -{ - Slotname [ en-US ] = "To Line Below"; -}; -SfxSlotInfo FN_LINE_DOWN_SEL -{ - Slotname [ en-US ] = "Select Down"; -}; -SfxSlotInfo FN_LINE_NUMBERING_DLG -{ - Slotname [ en-US ] = "Set Line Numbering"; -}; -SfxSlotInfo FN_LINE_UP -{ - Slotname [ en-US ] = "To Top Line"; -}; -SfxSlotInfo FN_LINE_UP_SEL -{ - Slotname [ en-US ] = "Select to Top Line"; -}; -SfxSlotInfo FN_NAVIGATION_PI_GOTO_PAGE -{ - Slotname [ en-US ] = "To Page"; -}; -SfxSlotInfo FN_NEW_GLOBAL_DOC -{ - Slotname [ en-US ] = "Create Master Document"; -}; -SfxSlotInfo FN_NEW_HTML_DOC -{ - Slotname [ en-US ] = "Create HTML Document"; -}; -SfxSlotInfo FN_NEXT_BOOKMARK -{ - Slotname [ en-US ] = "To Next Bookmark"; -}; -SfxSlotInfo FN_NEXT_FOOTNOTE -{ - Slotname [ en-US ] = "To Next Footnote"; -}; -SfxSlotInfo FN_NEXT_PARA -{ - Slotname [ en-US ] = "To Next Paragraph"; -}; -SfxSlotInfo FN_NEXT_SENT -{ - Slotname [ en-US ] = "To Next Sentence"; -}; -SfxSlotInfo FN_NEXT_SENT_SEL -{ - Slotname [ en-US ] = "Select to Next Sentence"; -}; -SfxSlotInfo FN_NEXT_TABLE -{ - Slotname [ en-US ] = "To Next Table"; -}; -SfxSlotInfo FN_NEXT_TBLFML -{ - Slotname [ en-US ] = "Go to next table formula"; -}; -SfxSlotInfo FN_NEXT_TBLFML_ERR -{ - Slotname [ en-US ] = "Go to next faulty table formula"; -}; -SfxSlotInfo FN_NEXT_TOXMARK -{ - Slotname [ en-US ] = "Go to Next Index Mark"; -}; -SfxSlotInfo FN_NEXT_WORD -{ - Slotname [ en-US ] = "To Word Right"; -}; -SfxSlotInfo FN_NEXT_WORD_SEL -{ - Slotname [ en-US ] = "Select to Word Right"; -}; -SfxSlotInfo FN_NUM_BULLET_DOWN -{ - Slotname [ en-US ] = "Down One Level"; -}; -SfxSlotInfo FN_NUM_BULLET_MOVEDOWN -{ - Slotname [ en-US ] = "Move Down"; -}; -SfxSlotInfo FN_NUM_BULLET_MOVEUP -{ - Slotname [ en-US ] = "Move Up"; -}; -SfxSlotInfo FN_NUM_BULLET_NEXT -{ - Slotname [ en-US ] = "To Next Paragraph in Level"; -}; -SfxSlotInfo FN_NUM_BULLET_NONUM -{ - Slotname [ en-US ] = "Insert Unnumbered Entry"; -}; -SfxSlotInfo FN_NUM_BULLET_OFF -{ - Slotname [ en-US ] = "Numbering Off"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_DOWN -{ - Slotname [ en-US ] = "Move Down with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_MOVEDOWN -{ - Slotname [ en-US ] = "Move Down with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_MOVEUP -{ - Slotname [ en-US ] = "Move Up with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_UP -{ - Slotname [ en-US ] = "Move Up with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_PREV -{ - Slotname [ en-US ] = "To Previous Paragraph in Level"; -}; -SfxSlotInfo FN_NUM_BULLET_UP -{ - Slotname [ en-US ] = "Up One Level"; -}; -SfxSlotInfo FN_NUM_FORMAT_TABLE_DLG -{ - Slotname [ en-US ] = "Edit Number Format"; -}; -SfxSlotInfo FN_NUM_OR_NONUM -{ - Slotname [ en-US ] = "Numbering On/Off"; -}; -SfxSlotInfo FN_NUMBER_BULLETS -{ - Slotname [ en-US ] = "Edit Numbering"; -}; -SfxSlotInfo FN_NUMBER_CURRENCY -{ - Slotname [ en-US ] = "Number Format: Currency"; -}; -SfxSlotInfo FN_NUMBER_DATE -{ - Slotname [ en-US ] = "Number Format : Date"; -}; -SfxSlotInfo FN_NUMBER_NEWSTART -{ - Slotname [ en-US ] = "Restart Numbering"; -}; -SfxSlotInfo FN_NUMBER_PERCENT -{ - Slotname [ en-US ] = "Number Format: Percent"; -}; -SfxSlotInfo FN_NUMBER_SCIENTIFIC -{ - Slotname [ en-US ] = "Number Format: Exponential"; -}; -SfxSlotInfo FN_NUMBER_STANDARD -{ - Slotname [ en-US ] = "Number Format: Standard"; -}; -SfxSlotInfo FN_NUMBER_TIME -{ - Slotname [ en-US ] = "Number Format: Time"; -}; -SfxSlotInfo FN_NUMBER_TWODEC -{ - Slotname [ en-US ] = "Number Format: Decimal"; -}; -SfxSlotInfo FN_NUMBERING_OUTLINE_DLG -{ - Slotname [ en-US ] = "Outline Numbering"; -}; -SfxSlotInfo FN_OPTIMIZE_TABLE -{ - Slotname [ en-US ] = "Optimize"; -}; -SfxSlotInfo FN_OUTLINE_TO_CLIPBOARD -{ - Slotname [ en-US ] = "Outline to Clipboard"; -}; -SfxSlotInfo FN_OUTLINE_TO_IMPRESS -{ - Slotname [ en-US ] = "Outline to Presentation"; -}; -SfxSlotInfo FN_PAGE_STYLE_SET_COLS -{ - Slotname [ en-US ] = "Page Style: Columns"; -}; -SfxSlotInfo FN_PAGEDOWN -{ - Slotname [ en-US ] = "Next Page"; -}; -SfxSlotInfo FN_PAGEDOWN_SEL -{ - Slotname [ en-US ] = "Select to Next Page"; -}; -SfxSlotInfo FN_PAGEUP -{ - Slotname [ en-US ] = "Previous Page"; -}; -SfxSlotInfo FN_PAGEUP_SEL -{ - Slotname [ en-US ] = "Select to Previous Page"; -}; -SfxSlotInfo FN_PASTESPECIAL -{ - Slotname [ en-US ] = "Paste Special"; -}; -SfxSlotInfo FN_PASTEUNFORMATTED -{ - Slotname [ en-US ] = "Paste Unformatted Text"; -}; -SfxSlotInfo FN_POSTIT -{ - Slotname [ en-US ] = "Insert Note"; -}; -SfxSlotInfo FN_PREV_BOOKMARK -{ - Slotname [ en-US ] = "To Previous Bookmark"; -}; -SfxSlotInfo FN_PREV_FOOTNOTE -{ - Slotname [ en-US ] = "To Previous Footnote"; -}; -SfxSlotInfo FN_PREV_PARA -{ - Slotname [ en-US ] = "To Previous Paragraph"; -}; -SfxSlotInfo FN_PREV_SENT -{ - Slotname [ en-US ] = "To Previous Sentence"; -}; -SfxSlotInfo FN_PREV_SENT_SEL -{ - Slotname [ en-US ] = "Select to Previous Sentence"; -}; -SfxSlotInfo FN_PREV_TABLE -{ - Slotname [ en-US ] = "To Previous Table"; -}; -SfxSlotInfo FN_PREV_TBLFML -{ - Slotname [ en-US ] = "Go to previous table formula"; -}; -SfxSlotInfo FN_PREV_TBLFML_ERR -{ - Slotname [ en-US ] = "Go to previous faulty table formula"; -}; -SfxSlotInfo FN_PREV_TOXMARK -{ - Slotname [ en-US ] = "Go to Previous Index Mark"; -}; -SfxSlotInfo FN_PREV_WORD -{ - Slotname [ en-US ] = "To Word Left"; -}; -SfxSlotInfo FN_PREV_WORD_SEL -{ - Slotname [ en-US ] = "Select to Begin of Word"; -}; -SfxSlotInfo FN_PREVIEW_ZOOM -{ - Slotname [ en-US ] = "Preview Zoom"; -}; -SfxSlotInfo FN_PRINT_LAYOUT -{ - Slotname [ en-US ] = "Print Layout On/Off"; -}; -SfxSlotInfo FN_PRINT_PAGEPREVIEW -{ - Slotname [ en-US ] = "Print document"; -}; -SfxSlotInfo FN_MAILMERGE_WIZARD -{ - SlotName[ en-US ] = "Mail Merge Wizard"; -}; -SfxSlotInfo FN_QRY_MERGE -{ - Slotname [ en-US ] = "Prepare Mail Merge"; -}; -SfxSlotInfo FN_REDLINE_ACCEPT -{ - Slotname [ en-US ] = "Accept or Reject Changes"; -}; -SfxSlotInfo FN_REDLINE_COMMENT -{ - Slotname [ en-US ] = "Insert Comment"; -}; -SfxSlotInfo FN_REDLINE_ON -{ - Slotname [ en-US ] = "Switch on Review"; -}; -SfxSlotInfo FN_REDLINE_PROTECT -{ - Slotname [ en-US ] = "Protect Record of Changes"; -}; -SfxSlotInfo FN_REDLINE_SHOW -{ - Slotname [ en-US ] = "Highlight Changes"; -}; -SfxSlotInfo FN_REFRESH_VIEW -{ - Slotname [ en-US ] = "Restore View"; -}; -SfxSlotInfo FN_REPAGINATE -{ - Slotname [ en-US ] = "Repaginate"; -}; -SfxSlotInfo FN_REPEAT_SEARCH -{ - Slotname [ en-US ] = "Repeat Search"; -}; -SfxSlotInfo FN_RULER -{ - Slotname [ en-US ] = "Ruler On/Off"; -}; -SfxSlotInfo FN_SELECT_PARA -{ - Slotname [ en-US ] = "Select Paragraph"; -}; -SfxSlotInfo FN_SELECT_WORD -{ - Slotname [ en-US ] = "Select Word"; -}; -SfxSlotInfo FN_SET_ADD_MODE -{ - Slotname [ en-US ] = "MultiSelection On"; -}; -SfxSlotInfo FN_SET_EXT_MODE -{ - Slotname [ en-US ] = "Extended Selection On"; -}; -SfxSlotInfo FN_SET_PAGE_STYLE -{ - Slotname [ en-US ] = "Apply Page Style"; -}; -SfxSlotInfo FN_SET_SUB_SCRIPT -{ - Slotname [ en-US ] = "Subscript"; -}; -SfxSlotInfo FN_SET_SUPER_SCRIPT -{ - Slotname [ en-US ] = "Superscript"; -}; -SfxSlotInfo FN_SHADOWCURSOR -{ - Slotname [ en-US ] = "Direct Cursor On/Off"; -}; -SfxSlotInfo FN_SHIFT_BACKSPACE -{ - Slotname [ en-US ] = "Backspace"; -}; -SfxSlotInfo FN_SHOW_MULTIPLE_PAGES -{ - Slotname [ en-US ] = "Page Preview: Multiple Pages"; -}; -SfxSlotInfo FN_SHOW_TWO_PAGES -{ - Slotname [ en-US ] = "Page Preview: Two Pages"; -}; -SfxSlotInfo FN_SHOW_BOOKVIEW -{ - SlotName[ en-US ] = "Book Preview"; -}; -SfxSlotInfo FN_SHRINK_FONT_SIZE -{ - Slotname [ en-US ] = "Reduce Font"; -}; -SfxSlotInfo FN_SORTING_DLG -{ - Slotname [ en-US ] = "Sort"; -}; -SfxSlotInfo FN_START_DOC_DIRECT -{ - Slotname [ en-US ] = "Directly to Document Begin"; -}; -SfxSlotInfo FN_START_OF_COLUMN -{ - Slotname [ en-US ] = "To Column Begin"; -}; -SfxSlotInfo FN_START_OF_DOCUMENT -{ - Slotname [ en-US ] = "To Document Begin"; -}; -SfxSlotInfo FN_START_OF_DOCUMENT_SEL -{ - Slotname [ en-US ] = "Select to Document Begin"; -}; -SfxSlotInfo FN_START_OF_LINE -{ - Slotname [ en-US ] = "To Line Begin"; -}; -SfxSlotInfo FN_START_OF_LINE_SEL -{ - Slotname [ en-US ] = "Select to Begin of Line"; -}; -SfxSlotInfo FN_START_OF_NEXT_COLUMN -{ - Slotname [ en-US ] = "To Begin of Next Column"; -}; -SfxSlotInfo FN_START_OF_NEXT_PAGE -{ - Slotname [ en-US ] = "To Begin of Next Page"; -}; -SfxSlotInfo FN_START_OF_NEXT_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Begin of Next Page"; -}; -SfxSlotInfo FN_START_OF_PAGE -{ - Slotname [ en-US ] = "To Page Begin"; -}; -SfxSlotInfo FN_START_OF_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Page Begin"; -}; -SfxSlotInfo FN_START_OF_PARA -{ - Slotname [ en-US ] = "To Paragraph Begin"; -}; -SfxSlotInfo FN_START_OF_PARA_SEL -{ - Slotname [ en-US ] = "Select to Paragraph Begin"; -}; -SfxSlotInfo FN_START_OF_PREV_COLUMN -{ - Slotname [ en-US ] = "To Begin of Previous Column"; -}; -SfxSlotInfo FN_START_OF_PREV_PAGE -{ - Slotname [ en-US ] = "To Begin of Previous Page"; -}; -SfxSlotInfo FN_START_OF_PREV_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Begin of Previous Page"; -}; -SfxSlotInfo FN_START_TABLE -{ - Slotname [ en-US ] = "To Table Begin"; -}; -SfxSlotInfo FN_STAT_PAGE -{ - Slotname [ en-US ] = "Page Number"; -}; -SfxSlotInfo FN_STAT_SELMODE -{ - Slotname [ en-US ] = "Selection Mode"; -}; -SfxSlotInfo FN_STAT_TEMPLATE -{ - Slotname [ en-US ] = "Page Style"; -}; -SfxSlotInfo FN_TABLE_ADJUST_CELLS -{ - Slotname [ en-US ] = "Optimal Column Width"; -}; -SfxSlotInfo FN_TABLE_AUTOSUM -{ - Slotname [ en-US ] = "Sum"; -}; -SfxSlotInfo FN_TABLE_BALANCE_CELLS -{ - Slotname [ en-US ] = "Space Columns Equally"; -}; -SfxSlotInfo FN_TABLE_BALANCE_ROWS -{ - Slotname [ en-US ] = "Space Rows Equally "; -}; -SfxSlotInfo FN_TABLE_DELETE_COL -{ - Slotname [ en-US ] = "Delete Column"; -}; -SfxSlotInfo FN_TABLE_DELETE_ROW -{ - Slotname [ en-US ] = "Delete Row"; -}; -SfxSlotInfo FN_TABLE_INSERT_COL -{ - Slotname [ en-US ] = "Insert Column"; -}; -SfxSlotInfo FN_TABLE_INSERT_ROW -{ - Slotname [ en-US ] = "Insert Row"; -}; -SfxSlotInfo FN_TABLE_MERGE_CELLS -{ - Slotname [ en-US ] = "Merge Cells"; -}; -SfxSlotInfo FN_TABLE_MERGE_TABLE -{ - Slotname [ en-US ] = "Merge Table"; -}; -SfxSlotInfo FN_FORMAT_APPLY_HEAD1 -{ - Slotname [ en-US ] = "Apply Style Heading 1"; -}; -SfxSlotInfo FN_FORMAT_APPLY_HEAD2 -{ - Slotname [ en-US ] = "Apply Style Heading 2"; -}; -SfxSlotInfo FN_FORMAT_APPLY_HEAD3 -{ - Slotname [ en-US ] = "Apply Style Heading 3"; -}; -SfxSlotInfo FN_FORMAT_APPLY_DEFAULT -{ - Slotname [ en-US ] = "Apply Style Default"; -}; -SfxSlotInfo FN_FORMAT_APPLY_TEXTBODY -{ - Slotname [ en-US ] = "Apply Style Textbody"; -}; -SfxSlotInfo FN_TABLE_MODE_FIX -{ - Slotname [ en-US ] = "Table: Fixed"; -}; -SfxSlotInfo FN_TABLE_MODE_FIX_PROP -{ - Slotname [ en-US ] = "Table: Fixed, Proportional"; -}; -SfxSlotInfo FN_TABLE_MODE_VARIABLE -{ - Slotname [ en-US ] = "Table: Variable"; -}; -SfxSlotInfo FN_TABLE_OPTIMAL_HEIGHT -{ - Slotname [ en-US ] = "Optimal Row Height"; -}; -SfxSlotInfo FN_TABLE_SELECT_ALL -{ - Slotname [ en-US ] = "Select Table"; -}; -SfxSlotInfo FN_TABLE_SELECT_COL -{ - Slotname [ en-US ] = "Select Column"; -}; -SfxSlotInfo FN_TABLE_SELECT_ROW -{ - Slotname [ en-US ] = "Select Rows"; -}; -SfxSlotInfo FN_TABLE_SET_READ_ONLY_CELLS -{ - Slotname [ en-US ] = "Protect Cells"; -}; -SfxSlotInfo FN_TABLE_SET_ROW_HEIGHT -{ - Slotname [ en-US ] = "Row Height"; -}; -SfxSlotInfo FN_TABLE_SPLIT_CELLS -{ - Slotname [ en-US ] = "Split Cells"; -}; -SfxSlotInfo FN_TABLE_SPLIT_TABLE -{ - Slotname [ en-US ] = "Split Table"; -}; -SfxSlotInfo FN_TABLE_UNSET_READ_ONLY -{ - Slotname [ en-US ] = "Unprotect sheet"; -}; -SfxSlotInfo FN_TABLE_UNSET_READ_ONLY_CELLS -{ - Slotname [ en-US ] = "Unprotect cells"; -}; -SfxSlotInfo FN_TABLE_VERT_BOTTOM -{ - Slotname [ en-US ] = "Bottom"; -}; -SfxSlotInfo FN_TABLE_VERT_CENTER -{ - Slotname [ en-US ] = "Center ( vertical )"; -}; -SfxSlotInfo FN_TABLE_VERT_NONE -{ - Slotname [ en-US ] = "Top"; -}; -SfxSlotInfo FN_THESAURUS_DLG -{ - Slotname [ en-US ] = "Thesaurus"; -}; -SfxSlotInfo FN_TO_FOOTER -{ - Slotname [ en-US ] = "To Footer"; -}; -SfxSlotInfo FN_TO_HEADER -{ - Slotname [ en-US ] = "To Header"; -}; -SfxSlotInfo FN_TOOL_ANKER -{ - Slotname [ en-US ] = "Change Anchor"; -}; -SfxSlotInfo FN_TOOL_ANKER_AT_CHAR -{ - Slotname [ en-US ] = "Anchor to Character"; -}; -SfxSlotInfo FN_TOOL_ANKER_CHAR -{ - Slotname [ en-US ] = "Anchor as Character"; -}; -SfxSlotInfo FN_TOOL_ANKER_FRAME -{ - Slotname [ en-US ] = "Anchor To Frame"; -}; -SfxSlotInfo FN_TOOL_ANKER_PAGE -{ - Slotname [ en-US ] = "Anchor To Page"; -}; -SfxSlotInfo FN_TOOL_ANKER_PARAGRAPH -{ - Slotname [ en-US ] = "Anchor To Paragraph"; -}; -SfxSlotInfo FN_TOOL_GROUP -{ - Slotname [ en-US ] = "Group"; -}; -SfxSlotInfo FN_TOOL_HIERARCHIE -{ - Slotname [ en-US ] = "Change Position"; -}; -SfxSlotInfo FN_TOOL_UNGROUP -{ - Slotname [ en-US ] = "Ungroup"; -}; -SfxSlotInfo FN_UNDERLINE_DOUBLE -{ - Slotname [ en-US ] = "Double Underline "; -}; -SfxSlotInfo FN_UPDATE_ALL -{ - Slotname [ en-US ] = "Update All"; -}; -SfxSlotInfo FN_UPDATE_ALL_LINKS -{ - Slotname [ en-US ] = "Update All Links"; -}; -SfxSlotInfo FN_UPDATE_CUR_TOX -{ - Slotname [ en-US ] = "Update Index"; -}; -SfxSlotInfo FN_EDIT_CURRENT_TOX -{ - Slotname [ en-US ] = "Edit index"; -}; -SfxSlotInfo FN_UPDATE_FIELDS -{ - Slotname [ en-US ] = "Update Fields"; -}; -SfxSlotInfo FN_UPDATE_INPUTFIELDS -{ - Slotname [ en-US ] = "Update Input Fields"; -}; -SfxSlotInfo FN_UPDATE_TOX -{ - Slotname [ en-US ] = "Update Indexes"; -}; -SfxSlotInfo FN_VIEW_BOUNDS -{ - Slotname [ en-US ] = "Text Limits"; -}; -SfxSlotInfo FN_VIEW_FIELDNAME -{ - Slotname [ en-US ] = "Field Names On/Off"; -}; -SfxSlotInfo FN_VIEW_FIELDS -{ - Slotname [ en-US ] = "Fields"; -}; -SfxSlotInfo FN_VIEW_GRAPHIC -{ - Slotname [ en-US ] = "Graphics On/Off"; -}; - -SfxSlotInfo FN_VIEW_HIDDEN_PARA -{ - Slotname [ en-US ] = "Hidden Paragraphs"; -}; -SfxSlotInfo FN_VIEW_MARKS -{ - Slotname [ en-US ] = "Field Shadings"; -}; -SfxSlotInfo FN_VIEW_META_CHARS -{ - Slotname [ en-US ] = "Nonprinting Characters On/Off"; -}; -SfxSlotInfo FN_VIEW_TABLEGRID -{ - Slotname [ en-US ] = "Table Limits"; -}; -SfxSlotInfo FN_VLINEAL -{ - Slotname [ en-US ] = "Vertical Ruler"; -}; -SfxSlotInfo FN_VSCROLLBAR -{ - Slotname [ en-US ] = "Vertical Scroll Bar"; -}; -SfxSlotInfo FN_WRAP_ANCHOR_ONLY -{ - Slotname [ en-US ] = "Wrap First Paragraph"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR_BACKGROUND -{ - Slotname [ en-US ] = "Highlighting"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR_BACKGROUND_EXT -{ - Slotname [ en-US ] = "Highlight Fill"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR_EXT -{ - Slotname [ en-US ] = "Font Color Fill"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR2 -{ - Slotname [ en-US ] = "Font Color"; -}; -SfxSlotInfo SID_TEMPLATE_LOAD -{ - Slotname [ en-US ] = "Load Styles"; -}; -SfxSlotInfo FN_FORMAT_COLUMN -{ - Slotname [ en-US ] = "Columns"; -}; -SfxSlotInfo FN_INSERT_MULTI_TOX -{ - - Slotname [ en-US ] = "Insert Index"; -}; -SfxSlotInfo FN_INSERT_AUTH_ENTRY_DLG -{ - Slotname [ en-US ] = "Insert Bibliography Entry"; -}; - -SfxSlotInfo FN_EDIT_AUTH_ENTRY_DLG -{ - Slotname [ en-US ] = "Edit Bibliography Entry"; -}; - -SfxSlotInfo FN_REMOVE_CUR_TOX -{ - Slotname [ en-US ] = "Delete index"; -}; -SfxSlotInfo FN_EDIT_HYPERLINK -{ - Slotname [ en-US ] = "Edit hyperlink"; -}; -SfxSlotInfo FN_SET_MODOPT_TBLNUMFMT -{ - Slotname [ en-US ] = "Number Recognition"; -}; -SfxSlotInfo FN_UPDATE_CHARTS -{ - Slotname [ en-US ] = "Update Charts"; -}; -SfxSlotInfo FN_NAME_SHAPE -{ - Slotname [ en-US ] = "Name..."; -}; -// #i68101# -SfxSlotInfo FN_TITLE_DESCRIPTION_SHAPE -{ - Slotname [ en-US ] = "Description..."; -}; -SfxSlotInfo FN_CLOSE_PAGEPREVIEW -{ - Slotname [ en-US ] = "Close Preview"; -}; - -SfxSlotInfo FN_TO_FOOTNOTE_AREA -{ - Slotname [ en-US ] = "Edit Footnote/Endnote"; -}; - -SfxSlotInfo FN_READONLY_SELECTION_MODE -{ - Slotname [ en-US ] = "Select Text"; -}; - -SfxSlotInfo FN_TABLE_ROW_SPLIT -{ - Slotname [ en-US ] = "Break across page and columns"; -}; -SfxSlotInfo FN_WORDCOUNT_DIALOG -{ - SlotName[ en-US ] = "Word Count"; -}; -SfxSlotInfo FN_TABLE_DELETE_TABLE -{ - SlotName [ en-US ] = "Delete table"; -}; -SfxSlotInfo FN_TABLE_SELECT_CELL -{ - SlotName [ en-US ] = "Select cell"; -}; -SfxSlotInfo FN_CONVERT_TEXT_TO_TABLE -{ - SlotName [ en-US ] = "Convert Text to Table"; -}; - -SfxSlotInfo FN_CONVERT_TABLE_TO_TEXT -{ - SlotName [ en-US ] = "Convert Table to Text"; -}; -SfxSlotInfo FN_TABLE_SORT_DIALOG -{ - SlotName [ en-US ] = "Sort"; -}; -SfxSlotInfo FN_TABLE_HEADLINE_REPEAT -{ - SlotName [ en-US ] = "Heading Rows Repeat"; -}; -SfxSlotInfo FN_XFORMS_DESIGN_MODE -{ - SlotName[ en-US ] = "Design Mode On/Off"; -}; -SfxSlotInfo FN_XFORMS_INIT -{ - SlotName[ en-US ] = "XML Form Document"; -}; -SfxSlotInfo FN_NUM_CONTINUE -{ - SlotName[ en-US ] = "Continue previous numbering"; -}; - -SfxSlotInfo FN_INSERT_RLM -{ - SlotName[ en-US ] = "Right-to-left mark"; -}; -SfxSlotInfo FN_INSERT_LRM -{ - SlotName[ en-US ] = "Left-to-right mark"; -}; -SfxSlotInfo FN_INSERT_ZWSP -{ - SlotName[ en-US ] = "No-width no break"; -}; -SfxSlotInfo FN_INSERT_ZWNBSP -{ - SlotName[ en-US ] = "No-width optional break"; -}; -SfxSlotInfo FN_VIEW_NOTES -{ - Slotname [ en-US ] = "Notes"; -}; - diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 249500b95f98..c11092c5fd9d 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -34,9 +34,7 @@ #include <editeng/lrspitem.hxx> #include <editeng/adjitem.hxx> #include <editeng/brkitem.hxx> -#ifndef _SVX_SVDOBJ_HXX #include <svx/svdobj.hxx> -#endif #include <crsrsh.hxx> #include <doc.hxx> #include <pagefrm.hxx> @@ -719,7 +717,8 @@ BOOL SwCrsrShell::MoveFldType( const SwFieldType* pFldType, BOOL bNext, SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField( (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) ); - pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() ); + pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(), + pDoc->IsClipBoard() ); pTxtFld->ChgTxtNode( pTNd ); } diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx index fcdcd99241f4..85ff12b699e6 100644 --- a/sw/source/core/crsr/crstrvl1.cxx +++ b/sw/source/core/crsr/crstrvl1.cxx @@ -33,26 +33,30 @@ #include <viscrs.hxx> #include <callnk.hxx> -BOOL SwCrsrShell::IsStartWord() const +BOOL SwCrsrShell::IsStartWord( sal_Int16 nWordType ) const { - return pCurCrsr->IsStartWord(); + return pCurCrsr->IsStartWord( nWordType ); } -BOOL SwCrsrShell::IsEndWord() const + +BOOL SwCrsrShell::IsEndWord( sal_Int16 nWordType ) const +{ + return pCurCrsr->IsEndWord( nWordType ); +} + +BOOL SwCrsrShell::IsInWord( sal_Int16 nWordType ) const { - return pCurCrsr->IsEndWord(); + return pCurCrsr->IsInWord( nWordType ); } + BOOL SwCrsrShell::IsStartSentence() const { return pCurCrsr->IsStartEndSentence( false ); } + BOOL SwCrsrShell::IsEndSentence() const { return pCurCrsr->IsStartEndSentence( true ); } -BOOL SwCrsrShell::IsInWord() const -{ - return pCurCrsr->IsInWord(); -} BOOL SwCrsrShell::GoStartWord() diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index aeaeeeb300bc..9fd6dd0516e9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -144,7 +144,9 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, // Fuer das Ende merken wir uns die Ersetzungen und entferenen // hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen BOOL bEmpty = RES_TXTATR_FIELD != pHt->Which() || - !((SwTxtFld*)pHt)->GetFld().GetFld()->Expand().Len(); + !(static_cast<SwTxtFld const*>(pHt) + ->GetFld().GetFld()->ExpandField( + rNd.GetDoc()->IsClipBoard()).Len()); if ( bEmpty && nStart == nAkt ) { rArr.Insert( nAkt, rArr.Count() ); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index d8286d007395..5b381cbaaad2 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1141,19 +1141,19 @@ short SwCursor::MaxReplaceArived() } -BOOL SwCursor::IsStartWord() const +BOOL SwCursor::IsStartWord( sal_Int16 nWordType ) const { - return IsStartWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsStartWordWT( nWordType ); } -BOOL SwCursor::IsEndWord() const +BOOL SwCursor::IsEndWord( sal_Int16 nWordType ) const { - return IsEndWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsEndWordWT( nWordType ); } -BOOL SwCursor::IsInWord() const +BOOL SwCursor::IsInWord( sal_Int16 nWordType ) const { - return IsInWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsInWordWT( nWordType ); } BOOL SwCursor::GoStartWord() diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index a19ece4daf66..170193778421 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1480,6 +1480,17 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) pTmp->GetPoint()->nNode++; pTmp->GetPoint()->nContent.Assign( pTmp->GetCntntNode(), 0 ); } + // --> mst 2010-05-17 #i101009# + // prevent redlines that end on structural end node + if (& rDoc.GetNodes().GetEndOfContent() == + & pTmp->GetPoint()->nNode.GetNode()) + { + pTmp->GetPoint()->nNode--; + SwCntntNode *const pContentNode( pTmp->GetCntntNode() ); + pTmp->GetPoint()->nContent.Assign( pContentNode, + (pContentNode) ? pContentNode->Len() : 0 ); + } + // <-- rDoc.DeleteRedline( *pTmp, false, USHRT_MAX ); @@ -1499,6 +1510,17 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) pTmp->GetPoint()->nNode++; pTmp->GetPoint()->nContent.Assign( pTmp->GetCntntNode(), 0 ); } + // --> mst 2010-05-17 #i101009# + // prevent redlines that end on structural end node + if (& rDoc.GetNodes().GetEndOfContent() == + & pTmp->GetPoint()->nNode.GetNode()) + { + pTmp->GetPoint()->nNode--; + SwCntntNode *const pContentNode( pTmp->GetCntntNode() ); + pTmp->GetPoint()->nContent.Assign( pContentNode, + (pContentNode) ? pContentNode->Len() : 0 ); + } + // <-- } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() )); SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, aTimeStamp, aEmptyStr, 0, 0 ); diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index c9ee5b00e181..31484ac303dd 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -1604,17 +1604,9 @@ bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam, } // <-- { - // dann eine Kopie vom Cursor erzeugen um alle Pams aus den - // anderen Sichten aus dem Loeschbereich zu verschieben - // ABER NICHT SICH SELBST !! - SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); - ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); - - const bool bSuccess( DeleteRangeImpl( aDelPam ) ); + bool const bSuccess( DeleteRangeImpl( rPam ) ); if (!bSuccess) return false; - - *rPam.GetPoint() = *aDelPam.GetPoint(); } if( bJoinTxt ) @@ -1625,7 +1617,24 @@ bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam, return true; } -bool SwDoc::DeleteRangeImpl( SwPaM & rPam, const bool ) +bool SwDoc::DeleteRangeImpl(SwPaM & rPam, const bool) +{ + // move all cursors out of the deleted range. + // but first copy the given PaM, because it could be a cursor that + // would be moved! + SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); + ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); + + bool const bSuccess( DeleteRangeImplImpl( aDelPam ) ); + if (bSuccess) + { // now copy position from temp copy to given PaM + *rPam.GetPoint() = *aDelPam.GetPoint(); + } + + return bSuccess; +} + +bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam) { SwPosition *pStt = (SwPosition*)rPam.Start(), *pEnd = (SwPosition*)rPam.End(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index ebac34bf3540..f4e80e9de52a 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -1241,13 +1241,18 @@ void SwDoc::FldsToExpand( SwHash**& ppHashTbl, USHORT& rTblSize, // Eintrag in den HashTable eintragen // Eintrag vorhanden ? pFnd = Find( rName, ppHashTbl, rTblSize, &nPos ); + String const value(pFld->ExpandField(IsClipBoard())); if( pFnd ) + { // Eintrag in der HashTabelle aendern - ((_HashStr*)pFnd)->aSetStr = pFld->Expand(); + static_cast<_HashStr*>(pFnd)->aSetStr = value; + } else + { // neuen Eintrag einfuegen *(ppHashTbl + nPos ) = new _HashStr( rName, - pFld->Expand(), (_HashStr*)*(ppHashTbl + nPos)); + value, static_cast<_HashStr *>(*(ppHashTbl + nPos))); + } } break; } @@ -1413,13 +1418,18 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // Eintrag vorhanden ? USHORT nPos; SwHash* pFnd = Find( rName, pHashStrTbl, nStrFmtCnt, &nPos ); + String const value(pFld->ExpandField(IsClipBoard())); if( pFnd ) + { // Eintrag in der HashTabelle aendern - ((_HashStr*)pFnd)->aSetStr = pFld->Expand(); + static_cast<_HashStr*>(pFnd)->aSetStr = value; + } else + { // neuen Eintrag einfuegen *(pHashStrTbl + nPos ) = new _HashStr( rName, - pFld->Expand(), (_HashStr*)*(pHashStrTbl + nPos)); + value, static_cast<_HashStr *>(*(pHashStrTbl + nPos))); + } } break; case RES_GETEXPFLD: @@ -2724,7 +2734,7 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, //pDstFld->ChangeFormat( rSrcFld.GetFormat() ); //pDstFld->SetLanguage( rSrcFld.GetLanguage() ); - SwField * pNewFld = rSrcFld.Copy(); + SwField * pNewFld = rSrcFld.CopyField(); pDstFmtFld->SetFld(pNewFld); switch( nFldWhich ) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 71dc70106245..9997eabd79c3 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -914,17 +914,24 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) case POS_INSIDE: { - pNewRedl->PushData( *pRedl, FALSE ); if( *pRStt == *pStt ) { - pRedl->SetStart( *pEnd, pRStt ); - // neu einsortieren - pRedlineTbl->Remove( n ); - pRedlineTbl->Insert( pRedl, n ); - bDec = true; + // --> mst 2010-05-17 #i97421# + // redline w/out extent loops + if (*pStt != *pEnd) + // <-- + { + pNewRedl->PushData( *pRedl, FALSE ); + pRedl->SetStart( *pEnd, pRStt ); + // re-insert + pRedlineTbl->Remove( n ); + pRedlineTbl->Insert( pRedl, n ); + bDec = true; + } } else { + pNewRedl->PushData( *pRedl, FALSE ); if( *pREnd != *pEnd ) { pNew = new SwRedline( *pRedl ); diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 2b2c809c3cb2..f627870932f9 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -54,6 +54,9 @@ SwExtTextInput::SwExtTextInput( const SwPaM& rPam, Ring* pRing ) SwExtTextInput::~SwExtTextInput() { + SwDoc *const pDoc = GetDoc(); + if (pDoc->IsInDtor()) { return; /* #i58606# */ } + SwTxtNode* pTNd = GetPoint()->nNode.GetNode().GetTxtNode(); if( pTNd ) { @@ -69,7 +72,6 @@ SwExtTextInput::~SwExtTextInput() // damit Undo / Redlining usw. richtig funktioniert, // muss ueber die Doc-Schnittstellen gegangen werden !!! - SwDoc* pDoc = GetDoc(); if(eInputLanguage != LANGUAGE_DONTKNOW) { // --> FME 2005-02-11 #i41974# Only set language attribute diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index e762de8489e3..a3e28fc0e425 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -377,32 +377,12 @@ USHORT SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) return (USHORT)pPageFrm->Prt().Width(); } - // Sonst versuchen wir es ueber die ViewShell - USHORT nWidth = GetBrowseWidthByVisArea( rDoc ); - if( !nWidth ) - { - // Und wenn das auch nicht geht, gibt es noch die ActualSize an der - // DocShell. - if( rDoc.GetDocShell() && GetpApp() && GetpApp()->GetDefaultDevice() ) - { - // this case shouldn't happen because the filter always waits until - // a view has been created -/* - nWidth = (USHORT)Application::GetDefaultDevice() - ->PixelToLogic( rDoc.GetDocShell()->GetActualSize(), - MapMode( MAP_TWIP ) ).Width(); -*/ - ASSERT( nWidth, "No browse width available" ); - } -#ifdef DBG_UTIL - else - { - // und wenn das auch nicht klappt, gibt es zur Zeit keine Breite - ASSERT( nWidth, "No browse width available" ); - } -#endif - } - return nWidth; + // --> OD 2010-05-12 #i91658# + // Assertion removed which state that no browse width is available. + // Investigation reveals that all calls can handle the case that no browse + // width is provided. + return GetBrowseWidthByVisArea( rDoc ); + // <-- } USHORT SwHTMLTableLayout::GetBrowseWidthByTabFrm( @@ -1859,7 +1839,7 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, // weil sond die Umschaltung von relativ nach absolut nicht funktioniert. if( pDoc->GetRootFrm() && pDoc->get(IDocumentSettingAccess::BROWSE_MODE) ) { - USHORT nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); + const USHORT nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); if( nVisAreaWidth < nAbsAvail && !FindFlyFrmFmt() ) nAbsAvail = nVisAreaWidth; } diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index df6c8dc8c9f2..cb804b102c0e 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -357,17 +357,19 @@ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) && 0 != (pTblNd = pANd->FindTableNode()) ) { - BOOL bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); + const BOOL bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); SwHTMLTableLayout *pLayout = pTblNd->GetTable().GetHTMLTableLayout(); if( pLayout ) { - USHORT nBrowseWidth = - pLayout->GetBrowseWidthByTable( *pDoc ); - if( nBrowseWidth ) + const USHORT nBrowseWidth = + pLayout->GetBrowseWidthByTable( *pDoc ); + if ( nBrowseWidth ) + { pLayout->Resize( nBrowseWidth, TRUE, TRUE, bLastGrf ? HTMLTABLE_RESIZE_NOW : 500 ); + } } } } diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 37ba5e5ced31..31c4a7dfea3e 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -457,7 +457,7 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos, const SwField* const pFld = pAttr->GetFld().GetFld(); if (pFld) { - sExp += pFld->Expand(); + sExp += pFld->ExpandField(rTNd.GetDoc()->IsClipBoard()); } } } diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index a919da9a6515..1e4f699fa203 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -42,9 +42,7 @@ #include <expfld.hxx> #include <flddat.hxx> #include <swundo.hxx> -#ifndef _DBMGR_HXX #include <dbmgr.hxx> -#endif #include <swddetbl.hxx> #include <hints.hxx> @@ -226,7 +224,8 @@ void SwEditShell::FieldToText( SwFieldType* pType ) *pFmtFld->GetTxtFld()->GetStart() ); // Feldinhalt durch Text ersetzen - String aEntry( pFmtFld->GetFld()->Expand() ); + String const aEntry( + pFmtFld->GetFld()->ExpandField(GetDoc()->IsClipBoard()) ); pPaM->SetMark(); pPaM->Move( fnMoveForward ); GetDoc()->DeleteRange( *pPaM ); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 7af79fde80a8..32ab9fa07e94 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -1162,8 +1162,7 @@ void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData ) void SwEditShell::TransliterateText( sal_uInt32 nType ) { - utl::TransliterationWrapper aTrans( - ::comphelper::getProcessServiceFactory(), nType ); + utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType ); StartAllAction(); SET_CURR_SHELL( this ); @@ -1185,6 +1184,32 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) EndAllAction(); } +void SwEditShell::TransliterateText( const String& rModuleName ) +{ + utl::TransliterationWrapper aTrans(::comphelper::getProcessServiceFactory(), 0 ); + aTrans.loadModuleByImplName( rModuleName, LANGUAGE_SYSTEM ); + StartAllAction(); + SET_CURR_SHELL( this ); + + SwPaM* pCrsr = GetCrsr(); + if( pCrsr->GetNext() != pCrsr ) + { + GetDoc()->StartUndo(UNDO_EMPTY, NULL); + FOREACHPAM_START( this ) + + if( PCURCRSR->HasMark() ) + GetDoc()->TransliterateText( *PCURCRSR, aTrans ); + + FOREACHPAM_END() + GetDoc()->EndUndo(UNDO_EMPTY, NULL); + } + else + GetDoc()->TransliterateText( *pCrsr, aTrans ); + + EndAllAction(); +} + + void SwEditShell::CountWords( SwDocStat& rStat ) const { FOREACHPAM_START( this ) diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index aa46869bca1a..182ed12d6ddd 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -203,7 +203,8 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const break; default: - nRet = rCalcPara.rCalc.Calculate( pFld->Expand() ).GetDouble(); + String const value(pFld->ExpandField(pDoc->IsClipBoard())); + nRet = rCalcPara.rCalc.Calculate(value).GetDouble(); } } else diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index ec65d0644bba..c47bd63e70ad 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -437,6 +437,23 @@ BOOL SwField::IsFixed() const return bRet; } +String SwField::ExpandField(bool const bInClipboard) const +{ + if (!bInClipboard) // #i85766# do not expand fields in clipboard documents + { + m_Cache = Expand(); + } + return m_Cache; +} + +SwField * SwField::CopyField() const +{ + SwField *const pNew = Copy(); + // #i85766# cache expansion of source (for clipboard) + pNew->m_Cache = Expand(); + return pNew; +} + /*-------------------------------------------------------------------- Beschreibung: Numerierung expandieren --------------------------------------------------------------------*/ diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 552555e925f9..e1560a230d7a 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -250,10 +250,6 @@ class SwFrm: public SwClient friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL ); friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow ); - //Checkt ob sich beim MakePos die Pos des Frm aendert oder nicht - //layact.cxx - friend BOOL CheckPos( SwFrm *pFrm ); - #if OSL_DEBUG_LEVEL > 1 //entfernt leere SwSectionFrms aus einer Kette friend SwFrm* SwClearDummies( SwFrm* pFrm ); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 1475a3909220..b51b2efc0a51 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1670,24 +1670,6 @@ BOOL SwLayAction::FormatLayoutFly( SwFlyFrm* pFly ) } // OD 31.10.2002 #104100# -// NOTE: no adjustments for vertical layout support necessary -BOOL CheckPos( SwFrm *pFrm ) -{ - if ( !pFrm->GetValidPosFlag() ) - { - Point aOld( pFrm->Frm().Pos() ); - pFrm->MakePos(); - if ( aOld != pFrm->Frm().Pos() ) - { - pFrm->Frm().Pos( aOld ); - pFrm->_InvalidatePos(); - return FALSE; - } - } - return TRUE; -} - -// OD 31.10.2002 #104100# // Implement vertical layout support BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect ) { diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index f912be5cb9b1..b747c4e7aaff 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1680,62 +1680,6 @@ BOOL MA_FASTCALL lcl_InnerCalcLayout( SwFrm *pFrm, return bRet; } -void MA_FASTCALL lcl_FirstTabCalc( SwTabFrm *pTab ) -{ - SWRECTFN( pTab ) - if ( !pTab->IsFollow() && !pTab->GetTable()->IsTblComplex() ) - { - SwLayoutFrm* pRow = (SwLayoutFrm*)pTab->Lower(); - // --> FME 2006-07-17 #134526# TabFrm without a lower? Better we check - // it before crashing. However, I still don't know how this can happen! - while ( pRow ) - { - SwLayoutFrm *pCell = (SwLayoutFrm*)pRow->Lower(); - SwFrm *pCnt = pCell->Lower(); - // --> OD 2006-11-08 #i70641# - make code robust - if ( pCnt ) - { - pCnt->Calc(); - const long nCellHeight = (pCell->Frm().*fnRect->fnGetHeight)(); - const long nCellY = (pCell->Frm().*fnRect->fnGetTop)()-1; - const long nCntHeight = (pCnt->Frm().*fnRect->fnGetHeight)(); - const long nCntY = (pCnt->Frm().*fnRect->fnGetTop)()-1; - if ( 0 != (pCell = (SwLayoutFrm*)pCell->GetNext()) ) - { - do - { - (pCell->Frm().*fnRect->fnSetTopAndHeight)( nCellY, nCellHeight ); - (pCell->Prt().*fnRect->fnSetHeight)( nCellHeight ); - pCell->_InvalidateAll(); - - pCnt = pCell->Lower(); - if ( pCnt ) - { - (pCnt->Frm().*fnRect->fnSetTopAndHeight)(nCntY, nCntHeight); - (pCnt->Prt().*fnRect->fnSetHeight)( nCntHeight ); - pCnt->_InvalidateAll(); - } - - pCell = (SwLayoutFrm*)pCell->GetNext(); - } while ( pCell ); - } - - SwTwips nRowTop = (pRow->Frm().*fnRect->fnGetTop)(); - SwTwips nUpBot = (pTab->GetUpper()->Frm().*fnRect->fnGetBottom)(); - if( (*fnRect->fnYDiff)( nUpBot, nRowTop ) < 0 ) - break; - } - // <-- - pRow = (SwLayoutFrm*)pRow->GetNext(); - } - } - SwFrm *pUp = pTab->GetUpper(); - long nBottom = (pUp->*fnRect->fnGetPrtBottom)(); - if ( pTab->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) - nBottom += pUp->Grow( LONG_MAX, TRUE ); - lcl_CalcLowers( (SwLayoutFrm*)pTab->Lower(), pTab, LONG_MAX, false ); -} - void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) { // --> OD 2004-10-05 #i26945# - For correct appliance of the 'straightforward @@ -2146,17 +2090,13 @@ void SwTabFrm::MakeAll() if ( !bValidSize || !bValidPrtArea ) { - // HB #i101593# no optimization as it leeds to not layouting certain nested tables - // const BOOL bOptLower = (Frm().*fnRect->fnGetHeight)() == 0; - const BOOL bOptLower = FALSE; - const long nOldPrtWidth = (Prt().*fnRect->fnGetWidth)(); const long nOldFrmWidth = (Frm().*fnRect->fnGetWidth)(); const Point aOldPrtPos = (Prt().*fnRect->fnGetPos)(); Format( pAttrs ); SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout(); - if ( /*!bOptLower &&*/ pLayout && + if ( pLayout && ((Prt().*fnRect->fnGetWidth)() != nOldPrtWidth || (Frm().*fnRect->fnGetWidth)() != nOldFrmWidth) ) { @@ -2167,100 +2107,8 @@ void SwTabFrm::MakeAll() pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this ); pAttrs = pAccess->Get(); } - if ( !bOptLower && aOldPrtPos != (Prt().*fnRect->fnGetPos)() ) + if ( aOldPrtPos != (Prt().*fnRect->fnGetPos)() ) aNotify.SetLowersComplete( FALSE ); - - if ( bOptLower && Lower() ) - { - //MA 24. May. 95: Optimierungsversuch! - //Ganz nigel nagel neu das Teil. Damit wir nicht n-fach - //MakeAll'en formatieren wir flugs den Inhalt. - //Das erste Format mussten wir allerdings abwarten, damit - //die Breiten Stimmen! - //MA: Fix, Kein Calc wenn evtl. noch Seitengebunde Flys - //an den Cntnt haengen (siehe frmtool.cxx, ~SwCntntNotify). - SwDoc *pDoc = GetFmt()->GetDoc(); - if ( !pDoc->GetSpzFrmFmts()->Count() || - pDoc->IsLoaded() || pDoc->IsNewDoc() ) - { - //MA 28. Nov. 95: Und wieder ein Trick, gleich mal sehen - //ob ein Rueckfluss lohnt. - if ( bMoveable && !GetPrev() ) - { - GetLeaf( MAKEPAGE_NONE, FALSE ); //setzt das BackMoveJump - if ( SwFlowFrm::IsMoveBwdJump() ) - { - BOOL bDummy; - SwFtnBossFrm *pOldBoss = bFtnsInDoc ? - FindFtnBossFrm( TRUE ) : 0; - const BOOL bOldPrev = GetPrev() != 0; - if ( MoveBwd( bDummy ) ) - { - SWREFRESHFN( this ) - bMovedBwd = TRUE; - if ( bFtnsInDoc ) - MoveLowerFtns( 0, pOldBoss, 0, TRUE ); - - long nOldTop = (Frm().*fnRect->fnGetTop)(); - MakePos(); - if( nOldTop != (Frm().*fnRect->fnGetTop)() ) - { - SwHTMLTableLayout *pHTMLLayout = - GetTable()->GetHTMLTableLayout(); - if( pHTMLLayout ) - { - delete pAccess; - bCalcLowers |= pHTMLLayout->Resize( - pHTMLLayout->GetBrowseWidthByTabFrm( - *this ), FALSE ); - pAccess= new SwBorderAttrAccess( - SwFrm::GetCache(), this ); - pAttrs = pAccess->Get(); - } - } - - if ( bOldPrev != (0 != GetPrev()) ) - { - //Abstand nicht vergessen! - bValidPrtArea = FALSE; - Format( pAttrs ); - } - if ( bKeep && KEEPTAB ) - { - // --> OD 2005-09-28 #b6329202# - // Consider case that table is inside another - // table, because it has to be avoided, that - // superior table is formatted. - // Thus, find next content, table or section - // and, if a section is found, get its first - // content. -// SwFrm *pNxt = FindNextCnt(); -// // FindNextCnt geht ggf. in einen Bereich -// // hinein, in eine Tabelle allerdings auch -// if( pNxt && pNxt->IsInTab() ) -// pNxt = pNxt->FindTabFrm(); -// if ( pNxt ) -// { -// pNxt->Calc(); -// if ( !GetNext() ) -// bValidPos = FALSE; -// } - if ( 0 != lcl_FormatNextCntntForKeep( this ) && - !GetNext() ) - { - bValidPos = FALSE; - } - // <-- - } - } - } - } - ::lcl_FirstTabCalc( this ); - bValidSize = bValidPrtArea = FALSE; - Format( pAttrs ); - aNotify.SetLowersComplete( TRUE ); - } - } } //Wenn ich der erste einer Kette bin koennte ich mal sehen ob diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 438f7c246287..34c0a9843986 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -57,6 +57,9 @@ #include "pordrop.hxx" #include "crstate.hxx" // SwCrsrMoveState #include <pormulti.hxx> // SwMultiPortion +// --> OD 2010-05-05 #i111284# +#include <numrule.hxx> +// <-- // Nicht reentrant !!! // wird in GetCharRect gesetzt und im UnitUp/Down ausgewertet. @@ -143,6 +146,27 @@ void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, } } +// --> OD 2010-05-05 #i111284# +namespace { + bool AreListLevelIndentsApplicableAndLabelAlignmentActive( const SwTxtNode& rTxtNode ) + { + bool bRet( false ); + + if ( rTxtNode.AreListLevelIndentsApplicable() ) + { + const SwNumFmt& rNumFmt = + rTxtNode.GetNumRule()->Get( static_cast<USHORT>(rTxtNode.GetActualListLevel()) ); + if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + bRet = true; + } + } + + return bRet; + } +} // end of anonymous namespace +// <-- + /************************************************************************* * SwTxtMargin::CtorInitTxtMargin() *************************************************************************/ @@ -156,7 +180,9 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) const SvxLRSpaceItem &rSpace = pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace(); // --> OD 2009-09-08 #i95907#, #b6879723# - const bool bListLevelIndentsApplicable = pFrm->GetTxtNode()->AreListLevelIndentsApplicable(); + // --> OD 2010-05-05 #i111284# + const bool bListLevelIndentsApplicableAndLabelAlignmentActive( + AreListLevelIndentsApplicableAndLabelAlignmentActive( *(pFrm->GetTxtNode()) ) ); // <-- // @@ -181,9 +207,10 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // rSpace.GetLeft() + // rSpace.GetTxtLeft(); - ( bListLevelIndentsApplicable + ( bListLevelIndentsApplicableAndLabelAlignmentActive ? 0 : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) ); // <-- @@ -191,8 +218,9 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) else { // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) - if ( bListLevelIndentsApplicable || + if ( bListLevelIndentsApplicableAndLabelAlignmentActive || !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) // <-- { @@ -202,9 +230,10 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // rSpace.GetLeft() + // rSpace.GetTxtLeft(); - ( bListLevelIndentsApplicable + ( bListLevelIndentsApplicableAndLabelAlignmentActive ? 0 : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) ); // <-- @@ -292,10 +321,11 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nFirstLineOfs = nFLOfst; // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // if ( pFrm->IsRightToLeft() || // !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) if ( pFrm->IsRightToLeft() || - bListLevelIndentsApplicable || + bListLevelIndentsApplicableAndLabelAlignmentActive || !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) // <-- { diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 5cfffeaf5229..61f873b010b7 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -870,8 +870,9 @@ USHORT SwTOXAuthority::GetLevel() const -----------------------------------------------------------------------*/ void SwTOXAuthority::_GetText( String& rTxt, String& ) { - // - rTxt = m_rField.GetFld()->Expand(); + bool const isClipBoard( + m_rField.GetTxtFld()->GetTxtNode().GetDoc()->IsClipBoard()); + rTxt = m_rField.GetFld()->ExpandField(isClipBoard); } /* -----------------21.09.99 12:50------------------- diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 4ad6c773db1d..6b1adc76fbec 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -32,6 +32,7 @@ #include <fmtfld.hxx> #include <txtfld.hxx> #include <docufld.hxx> +#include <doc.hxx> #include "reffld.hxx" #include "ddefld.hxx" @@ -68,7 +69,7 @@ SwFmtFld::SwFmtFld( const SwField &rFld ) SwClient( rFld.GetTyp() ), pTxtAttr( 0 ) { - pField = rFld.Copy(); + pField = rFld.CopyField(); } // #i24434# @@ -83,7 +84,7 @@ SwFmtFld::SwFmtFld( const SwFmtFld& rAttr ) if(rAttr.GetFld()) { rAttr.GetFld()->GetTyp()->Add(this); - pField = rAttr.GetFld()->Copy(); + pField = rAttr.GetFld()->CopyField(); } } @@ -258,9 +259,10 @@ BOOL SwFmtFld::IsProtect() const |* *************************************************************************/ -SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos ) +SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos, + bool const bInClipboard) : SwTxtAttr( rAttr, nStartPos ) - , m_aExpand( rAttr.GetFld()->Expand() ) + , m_aExpand( rAttr.GetFld()->ExpandField(bInClipboard) ) , m_pTxtNode( 0 ) { rAttr.pTxtAttr = this; @@ -292,7 +294,8 @@ void SwTxtFld::Expand() const ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); const SwField* pFld = GetFld().GetFld(); - XubString aNewExpand( pFld->Expand() ); + XubString aNewExpand( + pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) ); if( aNewExpand == m_aExpand ) { diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 7d6b8959787b..45f6c5da2baf 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -289,39 +289,45 @@ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr ) } // Die Fussnoten duplizieren -void SwTxtFtn::CopyFtn( SwTxtFtn *pDest ) const +void SwTxtFtn::CopyFtn(SwTxtFtn & rDest, SwTxtNode & rDestNode) const { - if ( m_pStartNode && pDest->GetStartNode() ) + if (m_pStartNode && !rDest.GetStartNode()) { - // die Fussnoten koennen in unterschiedlichen Dokumenten stehen !! - SwDoc* pDstDoc = pDest->m_pTxtNode->GetDoc(); + // dest missing node section? create it here! + // (happens in SwTxtNode::CopyText if pDest == this) + rDest.MakeNewTextSection( rDestNode.GetNodes() ); + } + if (m_pStartNode && rDest.GetStartNode()) + { + // footnotes not necessarily in same document! + SwDoc *const pDstDoc = rDestNode.GetDoc(); SwNodes &rDstNodes = pDstDoc->GetNodes(); - // Wir kopieren nur den Inhalt der Sektion + // copy only the content of the section SwNodeRange aRg( *m_pStartNode, 1, *m_pStartNode->GetNode().EndOfSectionNode() ); - // Wir fuegen auf dem Ende von pDest ein, d.h. die Nodes - // werden angehaengt. nDestLen haelt die Anzahl der CntNodes - // in pDest _vor_ dem Kopieren. - SwNodeIndex aStart( *(pDest->GetStartNode()) ); + // insert at the end of rDest, i.e., the nodes are appended. + // nDestLen contains number of CntntNodes in rDest _before_ copy. + SwNodeIndex aStart( *(rDest.GetStartNode()) ); SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() ); ULONG nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1; m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, 0, aEnd, TRUE ); - // Wenn die Dest-Sektion nicht leer war, so muessen die alten - // Nodes geloescht werden: - // Vorher: Src: SxxxE, Dst: SnE - // Nachher: Src: SxxxE, Dst: SnxxxE - // und Src: SxxxE, Dst: SxxxE + // in case the destination section was not empty, delete the old nodes + // before: Src: SxxxE, Dst: SnE + // now: Src: SxxxE, Dst: SnxxxE + // after: Src: SxxxE, Dst: SxxxE aStart++; rDstNodes.Delete( aStart, nDestLen ); } - // Der benutzerdefinierte String muss auch uebertragen werden. + // also copy user defined number string if( GetFtn().aNumber.Len() ) - ((SwFmtFtn&)pDest->GetFtn()).aNumber = GetFtn().aNumber; + { + const_cast<SwFmtFtn &>(rDest.GetFtn()).aNumber = GetFtn().aNumber; + } } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 798d7e41602f..76560bae91d7 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1327,11 +1327,11 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr * const pHt, ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" ); switch( nWhich ) { - // Wenn wir es mit einem Fussnoten-Attribut zu tun haben, - // muessen wir natuerlich auch den Fussnotenbereich kopieren. + // copy nodesarray section with footnote content case RES_TXTATR_FTN : + ASSERT(pDest, "lcl_CopyHint: no destination text node?"); static_cast<const SwTxtFtn*>(pHt)->CopyFtn( - static_cast<SwTxtFtn*>(pNewHt)); + *static_cast<SwTxtFtn*>(pNewHt), *pDest); break; // Beim Kopieren von Feldern in andere Dokumente @@ -1535,6 +1535,13 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, xub_StrLen nTxtStartIdx = rStart.GetIndex(); xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken + if (pDest->GetDoc()->IsClipBoard() && this->GetNum()) + { + // #i111677# cache expansion of source (for clipboard) + pDest->m_pNumStringCache.reset( + new ::rtl::OUString(this->GetNumString())); + } + if( !nLen ) { // wurde keine Laenge angegeben, dann Kopiere die Attribute @@ -1637,6 +1644,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, // Del-Array fuer alle RefMarks ohne Ausdehnung SwpHts aRefMrkArr; + USHORT nDeletedDummyChars(0); //Achtung: kann ungueltig sein!! for (USHORT n = 0; ( n < nSize ); ++n) { @@ -1708,31 +1716,24 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(), nAttrStt, nAttrEnd ); -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -//JP 23.04.95: erstmal so gesondert hier behandeln. Am Besten ist es -// aber im CopyFtn wenn die pDestFtn keinen StartNode hat, -// sich diesen dann anlegt. -// Aber so kurz vor der BETA besser nicht anfassen. - if( RES_TXTATR_FTN == nWhich ) - { - SwTxtFtn* pFtn = (SwTxtFtn*)pNewHt; - pFtn->ChgTxtNode( this ); - pFtn->MakeNewTextSection( GetNodes() ); - lcl_CopyHint( nWhich, pHt, pFtn, 0, 0 ); - pFtn->ChgTxtNode( 0 ); - } - else -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - { - lcl_CopyHint( nWhich, pHt, pNewHt, 0, pDest ); - } + lcl_CopyHint(nWhich, pHt, pNewHt, 0, pDest); aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() ); } else { - pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt, - nAttrEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR ); - lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest ); + pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt - nDeletedDummyChars, + nAttrEnd - nDeletedDummyChars, nsSetAttrMode::SETATTR_NOTXTATRCHR ); + if (pNewHt) + { + lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest ); + } + else if (pHt->HasDummyChar()) + { + // The attribute that has failed to be copied would insert + // dummy char, so positions of the following attributes have + // to be shifted by one to compensate for that missing char. + ++nDeletedDummyChars; + } } if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark ) @@ -2826,6 +2827,11 @@ BOOL SwTxtNode::HasBullet() const //i53420 added max outline parameter XubString SwTxtNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, const unsigned int _nRestrictToThisLevel ) const { + if (GetDoc()->IsClipBoard() && m_pNumStringCache.get()) + { + // #i111677# do not expand number strings in clipboard documents + return *m_pNumStringCache; + } const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if ( pRule && IsCountedInList() && @@ -3049,8 +3055,10 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt, rTxt.Erase( nPos, 1 ); if( bExpandFlds ) { - const XubString aExpand( ((SwTxtFld*)pAttr)->GetFld(). - GetFld()->Expand() ); + const XubString aExpand( + static_cast<SwTxtFld const*>(pAttr)->GetFld() + .GetFld()->ExpandField( + GetDoc()->IsClipBoard())); rTxt.Insert( aExpand, nPos ); nPos = nPos + aExpand.Len(); nEndPos = nEndPos + aExpand.Len(); @@ -3197,7 +3205,9 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, { case RES_TXTATR_FIELD: { - const XubString aExpand( ((SwTxtFld*)pHt)->GetFld().GetFld()->Expand() ); + XubString const aExpand( + static_cast<SwTxtFld const*>(pHt)->GetFld().GetFld() + ->ExpandField(GetDoc()->IsClipBoard())); if( aExpand.Len() ) { aDestIdx++; // dahinter einfuegen; @@ -3293,7 +3303,9 @@ const ModelToViewHelper::ConversionMap* const SwTxtAttr* pAttr = (*pSwpHints2)[i]; if ( RES_TXTATR_FIELD == pAttr->Which() ) { - const XubString aExpand( ((SwTxtFld*)pAttr)->GetFld().GetFld()->Expand() ); + const XubString aExpand( + static_cast<SwTxtFld const*>(pAttr)->GetFld().GetFld() + ->ExpandField(GetDoc()->IsClipBoard())); if ( aExpand.Len() > 0 ) { const xub_StrLen nFieldPos = *pAttr->GetStart(); @@ -4435,6 +4447,10 @@ namespace { if ( pNumRuleItem.GetValue().Len() > 0 ) { mbAddTxtNodeToList = true; + // --> OD 2010-05-12 #i105562# + // + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + // <-- } } break; @@ -4446,10 +4462,6 @@ namespace { dynamic_cast<const SfxStringItem&>(pItem); ASSERT( pListIdItem.GetValue().Len() > 0, "<HandleSetAttrAtTxtNode(..)> - empty list id attribute not excepted. Serious defect -> please inform OD." ); -// const SfxStringItem& rListIdItemOfTxtNode = -// dynamic_cast<const SfxStringItem&>( -// rTxtNode.GetAttr( RES_PARATR_LIST_ID )); -// if ( pListIdItem.GetValue() != rListIdItemOfTxtNode.GetValue() ) const String sListIdOfTxtNode = rTxtNode.GetListId(); if ( pListIdItem.GetValue() != sListIdOfTxtNode ) { @@ -4563,11 +4575,6 @@ namespace { { const SfxStringItem* pListIdItem = dynamic_cast<const SfxStringItem*>(pItem); -// const SfxStringItem& rListIdItemOfTxtNode = -// dynamic_cast<const SfxStringItem&>( -// mrTxtNode.GetAttr( RES_PARATR_LIST_ID )); -// if ( pListIdItem && -// pListIdItem->GetValue() != rListIdItemOfTxtNode.GetValue() ) const String sListIdOfTxtNode = mrTxtNode.GetListId(); if ( pListIdItem && pListIdItem->GetValue() != sListIdOfTxtNode ) @@ -4972,7 +4979,9 @@ namespace { mrTxtNode.AddToList(); } // --> OD 2008-11-19 #i70748# - else if ( dynamic_cast<const SfxUInt16Item &>(mrTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, FALSE )).GetValue() > 0 ) + // --> OD 2010-05-12 #i105562# + else if ( mrTxtNode.GetpSwAttrSet() && + dynamic_cast<const SfxUInt16Item &>(mrTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, FALSE )).GetValue() > 0 ) { mrTxtNode.SetEmptyListStyleDueToSetOutlineLevelAttr(); } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index ff2a40cdd9eb..ac2f281b0d90 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1043,7 +1043,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd ); break; case RES_TXTATR_FIELD: - pNew = new SwTxtFld( (SwFmtFld&)rNew, nStt ); + pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt, + rDoc.IsClipBoard() ); break; case RES_TXTATR_FLYCNT: { diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index fe189d5adf50..8a3c6c507c93 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -63,12 +63,14 @@ SwPosition SwUndoField::GetPosition() } SwUndoFieldFromDoc::SwUndoFieldFromDoc(const SwPosition & rPos, - const SwField & _aOldField, - const SwField & _aNewField, + const SwField & rOldField, + const SwField & rNewField, SwMsgPoolItem * _pHnt, BOOL _bUpdate, SwUndoId _nId) - : SwUndoField(rPos,_nId), pOldField(_aOldField.Copy()), - pNewField(_aNewField.Copy()), pHnt(_pHnt), - bUpdate(_bUpdate) + : SwUndoField(rPos,_nId) + , pOldField(rOldField.CopyField()) + , pNewField(rNewField.CopyField()) + , pHnt(_pHnt) + , bUpdate(_bUpdate) { ASSERT(pOldField, "No old field!"); ASSERT(pNewField, "No new field!"); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 347a70190006..ef39a4e18950 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -868,7 +868,15 @@ void SwUndoDelete::Redo( SwUndoIter& rUndoIter ) SetPaM( rPam ); if( pRedlSaveData ) - rDoc.DeleteRedline( rPam, false, USHRT_MAX ); + { + bool bSuccess = FillSaveData(rPam, *pRedlSaveData, TRUE); + OSL_ENSURE(bSuccess, + "SwUndoDelete::Redo: used to have redline data, but now none?"); + if (!bSuccess) + { + delete pRedlSaveData, pRedlSaveData = 0; + } + } if( !bDelFullPara ) { diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 2c341cb53bf5..1a71a705b2fb 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1120,7 +1120,12 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam ) if (rDoc.GetDocShell() && (pRedl->GetComment() != String(::rtl::OUString::createFromAscii(""))) ) rDoc.GetDocShell()->Broadcast(SwRedlineHint(pRedl,SWREDLINE_INSERTED)); // - rDoc.AppendRedline( pRedl, true ); +#if OSL_DEBUG_LEVEL > 0 + bool const bSuccess = +#endif + rDoc.AppendRedline( pRedl, true ); + OSL_ENSURE(bSuccess, + "SwRedlineSaveData::RedlineToDoc: insert redline failed"); rDoc.SetRedlineMode_intern( eOld ); } diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 44991960ac25..d0d74fa023c7 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -78,7 +78,9 @@ public: , m_rThis(rThis) , m_bIsEndnote(bIsEndnote) , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis)) - , m_bIsDescriptor(0 == pFootnote) +// #i111177#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this +// , m_bIsDescriptor(0 == pFootnote) + , m_bIsDescriptor((0 == pFootnote) ? true : false) , m_pFmtFtn(pFootnote) { } diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 980306be3aec..ab486b71ed04 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1659,9 +1659,14 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex( aPropertyValues.Insert(pData, aPropertyValues.Count()); } Size aSize = rFmt.GetGraphicSize(); - aSize.Width() = TWIP_TO_MM100( aSize.Width() ); - aSize.Height() = TWIP_TO_MM100( aSize.Height() ); - pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); + // --> OD 2010-05-04 #i101131# - applying patch from CMC + // adjust conversion due to type mismatch between <Size> and <awt::Size> +// aSize.Width() = TWIP_TO_MM100( aSize.Width() ); +// aSize.Height() = TWIP_TO_MM100( aSize.Height() ); +// pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); + awt::Size aAwtSize(TWIP_TO_MM100(aSize.Width()), TWIP_TO_MM100(aSize.Height())); + pData = new PropValData((void*)&aAwtSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); + // <-- aPropertyValues.Insert(pData, aPropertyValues.Count()); const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation(); diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 9249d4e5d11b..c1ba4908a339 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -124,7 +124,8 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos ) switch( pHt->Which() ) { case RES_TXTATR_FIELD: - sOut = ((SwTxtFld*)pHt)->GetFld().GetFld()->Expand(); + sOut = static_cast<SwTxtFld const*>(pHt)->GetFld().GetFld() + ->ExpandField(rWrt.pDoc->IsClipBoard()); break; case RES_TXTATR_FTN: diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 2e67ffcde1f8..50b7bdc7ddc8 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -305,7 +305,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, } // Inhalt des Feldes ausgeben - String sExpand( pFld->Expand() ); + String const sExpand( pFld->ExpandField(rWrt.pDoc->IsClipBoard()) ); sal_Bool bNeedsCJKProcessing = sal_False; if( sExpand.Len() ) { diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 4fd450cbffd5..bb1567d978f6 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -547,18 +547,20 @@ void SwHTMLImageWatcher::init( sal_Int32 Width, sal_Int32 Height ) 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) && 0 != (pTblNd = pANd->FindTableNode()) ) { - sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); + const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); SwHTMLTableLayout *pLayout = pTblNd->GetTable().GetHTMLTableLayout(); if( pLayout ) { - sal_uInt16 nBrowseWidth = + const sal_uInt16 nBrowseWidth = pLayout->GetBrowseWidthByTable( *pDoc ); - if( nBrowseWidth ) + if ( nBrowseWidth ) + { pLayout->Resize( nBrowseWidth, sal_True, sal_True, bLastGrf ? HTMLTABLE_RESIZE_NOW : 500 ); + } } } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 1e4f975ba3ec..fba6a477757d 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -4957,7 +4957,7 @@ USHORT SwHTMLParser::ToTwips( USHORT nPixel ) const SwTwips SwHTMLParser::GetCurrentBrowseWidth() { - SwTwips nWidth = SwHTMLTableLayout::GetBrowseWidth( *pDoc ); + const SwTwips nWidth = SwHTMLTableLayout::GetBrowseWidth( *pDoc ); if( nWidth ) return nWidth; diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index 7dcb732df601..507c83c2a204 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -2902,7 +2902,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) case RES_HIDDENTXTFLD: if( TYP_CONDTXTFLD == ((SwHiddenTxtField*)pFld)->GetSubType() ) - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), + RTFOutFuncs::Out_String( rWrt.Strm(), + pFld->ExpandField(rWrt.pDoc->IsClipBoard()), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); else { @@ -2958,7 +2959,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) rWrt.Strm() >> cCh; if( ' ' != cCh ) // vorweg immer einen Trenner rWrt.Strm() << ' '; - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), + RTFOutFuncs::Out_String( rWrt.Strm(), + pFld->ExpandField(rWrt.pDoc->IsClipBoard()), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); } break; @@ -2967,7 +2969,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) if( aFldStt.Len() ) { rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' '; - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), + RTFOutFuncs::Out_String( rWrt.Strm(), + pFld->ExpandField(rWrt.pDoc->IsClipBoard()), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); rWrt.Strm() << "}}"; rRTFWrt.bOutFmtAttr = FALSE; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bb26e670928a..2e22e3518c90 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -731,9 +731,7 @@ void DocxAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eChar if ( *pIt < 0x0020 ) // filter out the control codes { impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt ); -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Ignored control code %x in a text run.", *pIt ); -#endif + OSL_TRACE( "Ignored control code %x in a text run.", *pIt ); } break; } @@ -744,23 +742,17 @@ void DocxAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eChar void DocxAttributeOutput::RawText( const String& /*rText*/, bool /*bForceUnicode*/, rtl_TextEncoding /*eCharSet*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )\n" ); -#endif + OSL_TRACE("TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )\n" ); } void DocxAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, const SwFmtRuby& /*rRuby*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )\n" ); -#endif + OSL_TRACE("TODO DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )\n" ); } void DocxAttributeOutput::EndRuby() { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::EndRuby()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::EndRuby()\n" ); } bool DocxAttributeOutput::AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark ) @@ -849,9 +841,7 @@ void DocxAttributeOutput::FieldVanish( const String& rTxt, ww::eField eType ) void DocxAttributeOutput::Redline( const SwRedlineData* /*pRedline*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )\n" ); } /// Append the number as 2-digit when less than 10. @@ -936,9 +926,7 @@ void DocxAttributeOutput::StartRedline( const SwRedlineData* pRedlineData ) break; case nsRedlineType_t::REDLINE_FORMAT: -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::StartRedline()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::StartRedline()\n" ); default: break; } @@ -960,9 +948,7 @@ void DocxAttributeOutput::EndRedline() break; case nsRedlineType_t::REDLINE_FORMAT: -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::EndRedline()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::EndRedline()\n" ); break; default: break; @@ -973,9 +959,7 @@ void DocxAttributeOutput::EndRedline() void DocxAttributeOutput::FormatDrop( const SwTxtNode& /*rNode*/, const SwFmtDrop& /*rSwFmtDrop*/, USHORT /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle )\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle )\n" ); } void DocxAttributeOutput::ParagraphStyle( USHORT nStyle ) @@ -990,7 +974,7 @@ void DocxAttributeOutput::ParagraphStyle( USHORT nStyle ) void DocxAttributeOutput::InTable() { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::InTable()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::InTable()\n" ); #endif } @@ -998,7 +982,7 @@ void DocxAttributeOutput::InTable() void DocxAttributeOutput::TableRowProperties( bool /*bHeader*/, long /*nCellHeight*/, bool /*bCannotSplit*/, bool /*bRightToLeft*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::TableRowProperties()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::TableRowProperties()\n" ); #endif } #endif @@ -1439,9 +1423,7 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer void DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t /*pNodeInfo*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO: DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo )\n" ); -#endif + OSL_TRACE( "TODO: DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo )\n" ); } void DocxAttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ) @@ -1455,16 +1437,12 @@ void DocxAttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointe void DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" ); -#endif + OSL_TRACE( "TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" ); } void DocxAttributeOutput::TableRowEnd( sal_uInt32 /*nDepth*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )\n" ); -#endif + OSL_TRACE( "TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )\n" ); } void DocxAttributeOutput::StartStyles() @@ -1483,7 +1461,7 @@ void DocxAttributeOutput::DefaultStyle( USHORT nStyle ) { // are these the values of enum ww::sti (see ../inc/wwstyles.hxx)? #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::DefaultStyle( USHORT nStyle )- %d\n", nStyle ); + OSL_TRACE( "TODO DocxAttributeOutput::DefaultStyle( USHORT nStyle )- %d\n", nStyle ); #else (void) nStyle; // to quiet the warning #endif @@ -1492,7 +1470,7 @@ void DocxAttributeOutput::DefaultStyle( USHORT nStyle ) void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) - some stuff still missing\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) - some stuff still missing\n" ); #endif // create the relation ID OString aRelId; @@ -1710,7 +1688,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po break; default: #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& rNdTopLeft ) - frame type '%s'\n", + OSL_TRACE( "TODO DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& rNdTopLeft ) - frame type '%s'\n", rFrame.GetWriterType() == sw::Frame::eTxtBox? "eTxtBox": ( rFrame.GetWriterType() == sw::Frame::eOle? "eOle": ( rFrame.GetWriterType() == sw::Frame::eFormControl? "eFormControl": "???" ) ) ); @@ -1839,7 +1817,7 @@ void DocxAttributeOutput::SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo break; default: #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Unknown section break to write: %d\n", nC ); + OSL_TRACE( "Unknown section break to write: %d\n", nC ); #endif break; } @@ -1879,7 +1857,7 @@ void DocxAttributeOutput::SectionLineNumbering( ULONG /*nRestartNo*/, const SwLi { // see 2.6.8 lnNumType (Line Numbering Settings) #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::SectionLineNumbering()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::SectionLineNumbering()\n" ); #endif } @@ -1965,7 +1943,7 @@ void DocxAttributeOutput::SectionPageNumbering( USHORT nNumType, USHORT nPageRes // see 2.6.12 pgNumType (Page Numbering Settings) #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::SectionPageNumbering()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::SectionPageNumbering()\n" ); #endif } @@ -2073,7 +2051,7 @@ void DocxAttributeOutput::NumberingDefinition( USHORT nId, const SwNumRule &rRul #if OSL_DEBUG_LEVEL > 0 // TODO ww8 version writes this, anything to do about it here? if ( rRule.IsContinusNum() ) - fprintf( stderr, "TODO DocxAttributeOutput::NumberingDefinition()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::NumberingDefinition()\n" ); #else (void) rRule; // to quiet the warning... #endif @@ -2265,7 +2243,7 @@ void DocxAttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossedOut ) void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& /*rEscapement*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::CharEscapement()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::CharEscapement()\n" ); #endif } @@ -2382,7 +2360,7 @@ void DocxAttributeOutput::CharWeight( const SvxWeightItem& rWeight ) void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::CharAutoKern()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::CharAutoKern()\n" ); #endif } @@ -2554,7 +2532,7 @@ void DocxAttributeOutput::TextINetFormat( const SwFmtINetFmt& rLink ) void DocxAttributeOutput::TextCharFormat( const SwFmtCharFmt& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::TextCharFormat()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::TextCharFormat()\n" ); #endif } @@ -2577,14 +2555,14 @@ void DocxAttributeOutput::RefField( const SwField& rFld, const String& rRef ) void DocxAttributeOutput::HiddenField( const SwField& /*rFld*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::HiddenField()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::HiddenField()\n" ); #endif } void DocxAttributeOutput::PostitField( const SwField* /* pFld*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::PostitField()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::PostitField()\n" ); #endif } @@ -2970,7 +2948,7 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) if ( m_rExport.bOutFlyFrmAttrs ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatFrameSize() - Fly frames\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatFrameSize() - Fly frames\n" ); #endif } else if ( m_rExport.bOutPageDescs ) @@ -2993,7 +2971,7 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) void DocxAttributeOutput::FormatPaperBin( const SvxPaperBinItem& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatPaperBin()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatPaperBin()\n" ); #endif } @@ -3002,7 +2980,7 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) if ( m_rExport.bOutFlyFrmAttrs ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "DocxAttributeOutput::FormatLRSpace() - Fly frames\n" ); + OSL_TRACE( "DocxAttributeOutput::FormatLRSpace() - Fly frames\n" ); #endif } else if ( m_rExport.bOutPageDescs ) @@ -3093,28 +3071,28 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) void DocxAttributeOutput::FormatSurround( const SwFmtSurround& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatSurround()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatSurround()\n" ); #endif } void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatVertOrientation()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatVertOrientation()\n" ); #endif } void DocxAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatHorizOrientation()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatHorizOrientation()\n" ); #endif } void DocxAttributeOutput::FormatAnchor( const SwFmtAnchor& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatAnchor()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatAnchor()\n" ); #endif } @@ -3129,7 +3107,7 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) } #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatBackground()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatBackground()\n" ); #endif } @@ -3215,9 +3193,7 @@ void DocxAttributeOutput::FormatKeep( const SvxFmtKeepItem& ) void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatTextGrid()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::FormatTextGrid()\n" ); } void DocxAttributeOutput::FormatLineNumbering( const SwFmtLineNumber& rNumbering ) diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index e238fdfc738a..0962edd65085 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -342,9 +342,7 @@ void DocxExport::OutputField( const SwField* pFld, ww::eField eFldType, const St void DocxExport::WriteFormData( const ::sw::mark::IFieldmark& /*rFieldmark*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::WriteFormData()\n" ); -#endif + OSL_TRACE( "TODO DocxExport::WriteFormData()\n" ); } void DocxExport::DoComboBox(const rtl::OUString& rName, @@ -404,9 +402,7 @@ void DocxExport::DoComboBox(const rtl::OUString& rName, void DocxExport::DoFormText(const SwInputField* /*pFld*/) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::ForFormText()\n" ); -#endif + OSL_TRACE( "TODO DocxExport::ForFormText()\n" ); } void DocxExport::ExportDocument_Impl() @@ -430,9 +426,7 @@ void DocxExport::ExportDocument_Impl() void DocxExport::OutputPageSectionBreaks( const SwTxtNode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" ); } @@ -480,23 +474,17 @@ void DocxExport::OutputEndNode( const SwEndNode& rEndNode ) void DocxExport::OutputTableNode( const SwTableNode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" ); } void DocxExport::OutputGrfNode( const SwGrfNode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" ); } void DocxExport::OutputOLENode( const SwOLENode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" ); } ULONG DocxExport::ReplaceCr( BYTE ) diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index 5f23f23a8dd5..13715fcd2bbe 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -47,7 +47,7 @@ DocxExportFilter::DocxExportFilter( const uno::Reference< lang::XMultiServiceFac bool DocxExportFilter::exportDocument() { - fprintf( stderr, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me + OSL_TRACE(, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me // get SwDoc* uno::Reference< uno::XInterface > xIfc( getModel(), uno::UNO_QUERY ); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 6686ae5b13d7..7f1b6658800e 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -170,10 +170,20 @@ void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet) rtl::OUString sHelp; { - uno::Any aTmp = xPropSet->getPropertyValue(C2U("Help")); - const rtl::OUString *pStr = (const rtl::OUString *)aTmp.getValue(); - if (pStr) - sHelp = *pStr; + // --> OD 2010-05-14 #160026# + // property "Help" does not exist and due to the no-existence an exception is thrown. +// uno::Any aTmp = xPropSet->getPropertyValue(C2U("Help")); + try + { + uno::Any aTmp = xPropSet->getPropertyValue(C2U("HelpText")); + // <-- + const rtl::OUString *pStr = (const rtl::OUString *)aTmp.getValue(); + if (pStr) + sHelp = *pStr; + } + catch( uno::Exception& ) + {} + // <-- } rtl::OUString sToolTip; @@ -270,25 +280,10 @@ void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet) sal_Int16 nTemp = 0; xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp; - sal_uInt32 nIsDefaultChecked(nTemp); + aFFData.setDefaultResult(nTemp); xPropSet->getPropertyValue(C2U("State")) >>= nTemp; - sal_uInt32 nIsChecked(nTemp); - - if (nIsDefaultChecked != nIsChecked) - { - switch (nIsChecked) - { - case false: - aFFData.setResult(0); - break; - case true: - aFFData.setResult(1); - break; - default: - ASSERT(!this, "how did that happen"); - } - } + aFFData.setResult(nTemp); ::rtl::OUString aStr; static ::rtl::OUString sName(C2U("Name")); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 9e114aa11b0a..76ad1dc354ea 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2713,7 +2713,7 @@ void MSWordExportBase::OutputContentNode( const SwCntntNode& rNode ) break; default: #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Unhandled node, type == %d\n", rNode.GetNodeType() ); + OSL_TRACE("Unhandled node, type == %d\n", rNode.GetNodeType() ); #endif break; } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f6fb18aa0c63..d5cdbf731375 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1023,7 +1023,8 @@ bool WW8_WrFkp::Combine() return false; if( nIMax ) memcpy( pFkp + ( nIMax + 1 ) * 4, pOfs, nIMax * nItemSize ); - DELETEZ( pOfs ); + delete[] pOfs; + pOfs = 0; ((BYTE*)pFkp)[511] = nIMax; bCombined = true; @@ -3775,7 +3776,8 @@ void MSWordExportBase::OutputStartNode( const SwStartNode & rNode) void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) { #ifdef DEBUG - ::std::clog << "<OutWW8_SwEndNode>" << dbg_out(&rNode) << ::std::endl; +// someone who knows what he wants should make this linkable when building with 'debug=t' ... +// ::std::clog << "<OutWW8_SwEndNode>" << dbg_out(&rNode) << ::std::endl; #endif ww8::WW8TableNodeInfo::Pointer_t pNodeInfo = mpTableInfo->getTableNodeInfo( &rNode ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 3d200268731d..5d96a74b009d 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -99,9 +99,7 @@ using namespace nsFieldFlags; void WW8Export::OutputGrfNode( const SwGrfNode& /*rNode*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "WW8Export::OutputGrfNode( const SwGrfNode& )\n" ); -#endif + OSL_TRACE("WW8Export::OutputGrfNode( const SwGrfNode& )\n" ); ASSERT( mpParentFrame, "frame not set!" ); if ( mpParentFrame ) { @@ -221,9 +219,7 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "WW8Export::OutputOLENode( const SwOLENode& rOLENode )\n" ); -#endif + OSL_TRACE("WW8Export::OutputOLENode( const SwOLENode& rOLENode )\n" ); BYTE *pSpecOLE; BYTE *pDataAdr; short nSize; @@ -607,7 +603,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, substitute the final size and loose on retaining the scaling factor but still keep the correct display size anyway. */ - if ( (aGrTwipSz.Width() > USHRT_MAX) || (aGrTwipSz.Height() > USHRT_MAX) + if ( (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX) || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) ) { aGrTwipSz.Width() = nWidth; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 2db25106d330..89aef162ec01 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1743,9 +1743,9 @@ static void InsertSpecialChar( WW8Export& rWrt, BYTE c, aItems.GetData()); } -String lcl_GetExpandedField(const SwField &rFld) +String lcl_GetExpandedField(const SwField &rFld, SwDoc const& rDoc) { - String sRet(rFld.Expand()); + String sRet(rFld.ExpandField(rDoc.IsClipBoard())); //replace LF 0x0A with VT 0x0B sRet.SearchAndReplaceAll(0x0A, 0x0B); @@ -1871,7 +1871,7 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType, { String sOut; if( pFld ) - sOut = lcl_GetExpandedField(*pFld); + sOut = lcl_GetExpandedField(*pFld, *pDoc); else sOut = rFldCmd; if( sOut.Len() ) @@ -2598,7 +2598,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef) sStr.APPEND_CONST_ASC( "\" " ); m_rWW8Export.OutputField( &rFld, ww::eREF, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END ); - String sVar = lcl_GetExpandedField( rFld ); + String sVar = lcl_GetExpandedField( rFld, *GetExport().pDoc ); if ( sVar.Len() ) { if ( m_rWW8Export.IsUnicode() ) @@ -2614,7 +2614,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef) void WW8AttributeOutput::WriteExpand( const SwField* pFld ) { - String sExpand( lcl_GetExpandedField( *pFld ) ); + String sExpand( lcl_GetExpandedField( *pFld, *GetExport().pDoc ) ); if ( m_rWW8Export.IsUnicode() ) SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sExpand, false ); else @@ -5261,9 +5261,7 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt ) break; default: -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Unhandled SfxPoolItem with id %d.\n", rHt.Which() ); -#endif + OSL_TRACE("Unhandled SfxPoolItem with id %d.\n", rHt.Which() ); break; } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 4a3a3c66e86a..5808e3981223 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -844,13 +844,35 @@ long lcl_GetTrueMargin(const SvxLRSpaceItem &rLR, const SwNumFmt &rFmt, return nExtraListIndent > 0 ? nExtraListIndent : 0; } -void SyncIndentWithList(SvxLRSpaceItem &rLR, const SwNumFmt &rFmt) +// --> OD 2010-05-06 #i103711# +// --> OD 2010-05-11 #i105414# +void SyncIndentWithList( SvxLRSpaceItem &rLR, + const SwNumFmt &rFmt, + const bool bFirstLineOfstSet, + const bool bLeftIndentSet ) { - long nWantedFirstLinePos; - long nExtraListIndent = lcl_GetTrueMargin(rLR, rFmt, nWantedFirstLinePos); - rLR.SetTxtLeft(nWantedFirstLinePos - nExtraListIndent); - rLR.SetTxtFirstLineOfst(0); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + long nWantedFirstLinePos; + long nExtraListIndent = lcl_GetTrueMargin(rLR, rFmt, nWantedFirstLinePos); + rLR.SetTxtLeft(nWantedFirstLinePos - nExtraListIndent); + rLR.SetTxtFirstLineOfst(0); + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + if ( !bFirstLineOfstSet && bLeftIndentSet && + rFmt.GetFirstLineIndent() != 0 ) + { + rLR.SetTxtFirstLineOfst( rFmt.GetFirstLineIndent() ); + } + else if ( bFirstLineOfstSet && !bLeftIndentSet && + rFmt.GetIndentAt() != 0 ) + { + rLR.SetTxtLeft( rFmt.GetIndentAt() ); + } + } } +// <-- const SwNumFmt* SwWW8FltControlStack::GetNumFmtFromStack(const SwPosition &rPos, const SwTxtNode &rTxtNode) @@ -907,16 +929,24 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, pNum = GetNumFmtFromStack(*aRegion.GetPoint(), *pTxtNode); if (!pNum) + { pNum = GetNumFmtFromTxtNode(*pTxtNode); + } - // --> OD 2008-06-03 #i86652# -// if (pNum) - if ( pNum && - pNum->GetPositionAndSpaceMode() == - SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - // <-- + if ( pNum ) { - SyncIndentWithList(aNewLR, *pNum); + // --> OD 2010-05-06 #i103711# + const bool bFirstLineIndentSet = + ( rReader.maTxtNodesHavingFirstLineOfstSet.end() != + rReader.maTxtNodesHavingFirstLineOfstSet.find( pNode ) ); + // --> OD 2010-05-11 #i105414# + const bool bLeftIndentSet = + ( rReader.maTxtNodesHavingLeftIndentSet.end() != + rReader.maTxtNodesHavingLeftIndentSet.find( pNode ) ); + SyncIndentWithList( aNewLR, *pNum, + bFirstLineIndentSet, + bLeftIndentSet ); + // <-- } if (aNewLR == aOldLR) @@ -1681,6 +1711,13 @@ void SwWW8ImplReader::Read_HdFtText(long nStart, long nLen, SwFrmFmt* pHdFtFmt) *pPaM->GetPoint() = aTmpPos; } + +bool SwWW8ImplReader::isValid_HdFt_CP(WW8_CP nHeaderCP) const +{ + //each CP of Plcfhdd MUST be less than FibRgLw97.ccpHdd + return (nHeaderCP < pWwFib->ccpHdr) ? true : false; +} + bool SwWW8ImplReader::HasOwnHeaderFooter(BYTE nWhichItems, BYTE grpfIhdt, int nSect) { @@ -1700,7 +1737,7 @@ bool SwWW8ImplReader::HasOwnHeaderFooter(BYTE nWhichItems, BYTE grpfIhdt, else { pHdFt->GetTextPosExact( static_cast< short >(nNumber + (nSect+1)*6), start, nLen); - bOk = ( 2 <= nLen ); + bOk = ( 2 <= nLen ) && isValid_HdFt_CP(start); } if (bOk) @@ -1752,7 +1789,7 @@ void SwWW8ImplReader::Read_HdFt(bool bIsTitle, int nSect, else { pHdFt->GetTextPosExact( static_cast< short >(nNumber + (nSect+1)*6), start, nLen); - bOk = ( 2 <= nLen ); + bOk = ( 2 <= nLen ) && isValid_HdFt_CP(start); } bool bUseLeft @@ -2589,6 +2626,16 @@ bool SwWW8ImplReader::HandlePageBreakChar() //itself ignores them in this case. if (!nInTable) { + //xushanchuan add for issue106569 + BOOL IsTemp=TRUE; + SwTxtNode* pTemp = pPaM->GetNode()->GetTxtNode(); + if ( pTemp && !( pTemp->GetTxt().Len() ) && ( bFirstPara || bFirstParaOfPage ) ) + { + IsTemp = FALSE; + AppendTxtNode(*pPaM->GetPoint()); + pTemp->SetAttr(*GetDfltAttr(RES_PARATR_NUMRULE)); + } + //xushanchuan end bPgSecBreak = true; pCtrlStck->KillUnlockedAttrs(*pPaM->GetPoint()); /* @@ -2597,7 +2644,9 @@ bool SwWW8ImplReader::HandlePageBreakChar() paragraph end, but nevertheless, numbering (and perhaps other similiar constructs) do not exist on the para. */ - if (!bWasParaEnd) + //xushanchuan add for issue106569 + if (!bWasParaEnd && IsTemp) + //xushanchuan end { bParaEndAdded = true; if (0 >= pPaM->GetPoint()->nContent.GetIndex()) @@ -2633,6 +2682,10 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) sal_Char cInsert = '\x0'; bool bRet = false; + //xushanchuan add for issue106569 + if ( 0xc != nWCharVal ) + bFirstParaOfPage = false; + //xushanchuan end switch (nWCharVal) { case 0: @@ -3149,6 +3202,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) // <-- rDoc.InsertPoolItem(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); + bFirstParaOfPage = true;//xushanchuan add for issue106569 bPgSecBreak = false; } } @@ -3186,6 +3240,12 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage, maGrfNameGenerator(bNewDoc,String('G')), maParaStyleMapper(rD), maCharStyleMapper(rD), + // --> OD 2010-05-06 #i103711# + maTxtNodesHavingFirstLineOfstSet(), + // <-- + // --> OD 2010-05-11 #i105414# + maTxtNodesHavingLeftIndentSet(), + // <-- pMSDffManager(0), mpAtnNames(0), pAuthorInfos(0), @@ -3240,6 +3300,7 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage, bWasParaEnd = false; bDropCap = false; bFirstPara = true; + bFirstParaOfPage = false;//xushanchuan add for issue106569 bParaAutoBefore = false; bParaAutoAfter = false; nProgress = 0; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 8752c87dbc76..025cf0f588f4 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -946,6 +946,13 @@ private: WW8PLCFMan* pPlcxMan; std::map<short, String> aLinkStringMap; + // --> OD 2010-05-06 #i103711# + std::set<const SwNode*> maTxtNodesHavingFirstLineOfstSet; + // <-- + // --> OD 2010-05-11 #i105414# + std::set<const SwNode*> maTxtNodesHavingLeftIndentSet; + // <-- + WW8RStyle* pStyles; // Pointer auf die Style-Einleseklasse SwFmt* pAktColl; // gerade zu erzeugende Collection // ( ist ausserhalb einer Style-Def immer 0 ) @@ -1076,7 +1083,7 @@ private: // the very 1st Line Numbering and ignore the rest) bool bFirstPara; // first paragraph? - + bool bFirstParaOfPage;//cs2c--xushanchuan add for bug11210 bool bParaAutoBefore; bool bParaAutoAfter; @@ -1102,6 +1109,8 @@ private: void Read_HdFtTextAsHackedFrame(long nStart, long nLen, SwFrmFmt &rHdFtFmt, sal_uInt16 nPageWidth); + bool isValid_HdFt_CP(WW8_CP nHeaderCP) const; + bool HasOwnHeaderFooter(BYTE nWhichItems, BYTE grpfIhdt, int nSect); void HandleLineNumbering(const wwSection &rSection); @@ -1145,7 +1154,12 @@ private: void ImportTox( int nFldId, String aStr ); void EndSprm( USHORT nId ); - void NewAttr( const SfxPoolItem& rAttr ); + // --> OD 2010-05-06 #i103711# + // --> OD 2010-05-11 #i105414# + void NewAttr( const SfxPoolItem& rAttr, + const bool bFirstLineOfStSet = false, + const bool bLeftIndentSet = false ); + // <-- bool GetFontParams(USHORT, FontFamily&, String&, FontPitch&, rtl_TextEncoding&); @@ -1602,7 +1616,13 @@ public: // eigentlich private, geht aber leider nur public bool CanUseRemoteLink(const String &rGrfName); void UseListIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt); void SetStyleIndent(SwWW8StyInf &rStyleInfo, const SwNumFmt &rFmt); -void SyncIndentWithList(SvxLRSpaceItem &rLR, const SwNumFmt &rFmt); +// --> OD 2010-05-06 #i103711# +// --> OD 2010-05-11 #i105414# +void SyncIndentWithList( SvxLRSpaceItem &rLR, + const SwNumFmt &rFmt, + const bool bFirstLineOfStSet, + const bool bLeftIndentSet ); +// <-- long GetListFirstLineIndent(const SwNumFmt &rFmt); String BookmarkToWriter(const String &rBookmark); bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 465d07c0d2b5..75454dddbc58 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -1697,7 +1697,12 @@ void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt) { SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(*rStyle.pFmt, RES_LR_SPACE)); if (rStyle.bListReleventIndentSet) - SyncIndentWithList(aLR, rFmt); + { + // --> OD 2010-05-06 #i103711# + // --> OD 2010-05-11 #i105414# + SyncIndentWithList( aLR, rFmt, false, false ); + // <-- + } else { aLR.SetTxtLeft(0); @@ -2207,20 +2212,17 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, { *pDataStream >> nDefaultChecked; nChecked = nDefaultChecked; - //Don't know the details yet - switch (nHeaderByte) + + sal_uInt8 iRes = (nHeaderByte >> 2) & 0x1F; + switch (iRes) { - case 0x65: //01100101 - //use defaults ? + case 1: //checked + nChecked = true; break; - case 0x1: //00000001 - //swap to unchecked from checked (#114841)? + case 25: //undefined, Undefined checkboxes are treated as unchecked + case 0: //unchecked nChecked = false; break; - case 0x5: //00000101 - //change to checked - nChecked = true; - break; default: ASSERT(!this, "unknown option, please report to cmc"); break; diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 6dacf0d126fe..5d57a83481b5 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2716,7 +2716,9 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo, # Attribut - Verwaltung #**************************************************************************/ -void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr ) +void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr, + const bool bFirstLineOfStSet, + const bool bLeftIndentSet ) { if( !bNoAttrImport ) // zum Ignorieren von Styles beim Doc-Einfuegen { @@ -2726,11 +2728,31 @@ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr ) pAktColl->SetFmtAttr(rAttr); } else if (pAktItemSet) + { pAktItemSet->Put(rAttr); + } else if (rAttr.Which() == RES_FLTR_REDLINE) + { mpRedlineStack->open(*pPaM->GetPoint(), rAttr); + } else + { pCtrlStck->NewAttr(*pPaM->GetPoint(), rAttr); + // --> OD 2010-05-06 #i103711# + if ( bFirstLineOfStSet ) + { + const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode()); + maTxtNodesHavingFirstLineOfstSet.insert( pNd ); + } + // <-- + // --> OD 2010-05-11 #i105414# + if ( bLeftIndentSet ) + { + const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode()); + maTxtNodesHavingLeftIndentSet.insert( pNd ); + } + // <-- + } if (mpPostProcessAttrsInfo && mpPostProcessAttrsInfo->mbCopy) mpPostProcessAttrsInfo->mItemSet.Put(rAttr); @@ -3959,6 +3981,13 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) } } + // --> OD 2010-05-06 #i103711# + bool bFirstLinOfstSet( false ); + // <-- + // --> OD 2010-05-11 #i105414# + bool bLeftIndentSet( false ); + // <-- + switch (nId) { //sprmPDxaLeft @@ -3967,7 +3996,12 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) case 0x845E: aLR.SetTxtLeft( nPara ); if (pAktColl) + { pCollA[nAktColl].bListReleventIndentSet = true; + } + // --> OD 2010-05-11 #i105414# + bLeftIndentSet = true; + // <-- break; //sprmPDxaLeft1 case 19: @@ -3999,7 +4033,12 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) aLR.SetTxtFirstLineOfst(nPara); if (pAktColl) + { pCollA[nAktColl].bListReleventIndentSet = true; + } + // --> OD 2010-05-06 #i103711# + bFirstLinOfstSet = true; + // <-- break; //sprmPDxaRight case 16: @@ -4011,7 +4050,10 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) return; } - NewAttr(aLR); + // --> OD 2010-05-06 #i103711# + // --> OD 2010-05-11 #i105414# + NewAttr( aLR, bFirstLinOfstSet, bLeftIndentSet ); + // <-- } // Sprm 20 diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index fdd3c96c4e18..d318522100cf 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2122,7 +2122,7 @@ xub_StrLen WW8ScannerBase::WW8ReadString( SvStream& rStrm, String& rStr, // Bei nStartPos < 0 wird das erste Element des PLCFs genommen WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, long nFilePos, long nPLCF, - long nStruct, long nStartPos, bool bNoEnd) + long nStruct, long nStartPos) : nIdx(0), nStru(nStruct) { nIMax = ( nPLCF - 4 ) / ( 4 + nStruct ); @@ -2138,8 +2138,6 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, long nFilePos, long nPLCF, pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] ); nIdx = 0; #endif // OSL_BIGENDIAN - if( bNoEnd ) - nIMax++; if( nStruct ) // Pointer auf Inhalts-Array pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1]; else @@ -4005,8 +4003,7 @@ WW8PLCFx_Book::WW8PLCFx_Book(SvStream* pTblSt, const WW8Fib& rFib) { pBook[0] = new WW8PLCFspecial(pTblSt,rFib.fcPlcfbkf,rFib.lcbPlcfbkf,4); - pBook[1] = new WW8PLCFspecial( pTblSt, rFib.fcPlcfbkl, rFib.lcbPlcfbkl, - 0, -1, true); + pBook[1] = new WW8PLCFspecial(pTblSt,rFib.fcPlcfbkl,rFib.lcbPlcfbkl,0); rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(rFib.chseTables); diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index f63ae9321dea..33d40bcf4c0d 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -220,7 +220,7 @@ private: long nStru; public: WW8PLCFspecial( SvStream* pSt, long nFilePos, long nPLCF, - long nStruct, long nStartPos = -1, bool bNoEnd = false); + long nStruct, long nStartPos = -1 ); ~WW8PLCFspecial() { delete[] pPLCF_PosArray; } long GetIdx() const { return nIdx; } void SetIdx( long nI ) { nIdx = nI; } diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx index 73e5d69d7764..13cec2b93bb5 100644 --- a/sw/source/ui/config/viewopt.cxx +++ b/sw/source/ui/config/viewopt.cxx @@ -112,6 +112,7 @@ BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const && bFormView == rOpt.IsFormView() && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields + && bIdle == rOpt.bIdle #ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src && bTest1 == rOpt.IsTest1() @@ -226,7 +227,7 @@ SwViewOption::SwViewOption() : { // Initialisierung ist jetzt etwas einfacher // alle Bits auf 0 - nCoreOptions = VIEWOPT_1_IDLE | VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | + nCoreOptions = VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | VIEWOPT_1_REF | VIEWOPT_1_GRAPHIC | VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL | @@ -243,6 +244,8 @@ SwViewOption::SwViewOption() : bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly(); + bIdle = true; + #ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src bTest1 = bTest2 = bTest3 = bTest4 = @@ -277,6 +280,7 @@ SwViewOption::SwViewOption(const SwViewOption& rVOpt) bBookview = rVOpt.bBookview; mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; #ifdef DBG_UTIL bTest1 = rVOpt.bTest1 ; @@ -317,6 +321,7 @@ SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt ) bBookview = rVOpt.bBookview; mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; #ifdef DBG_UTIL bTest1 = rVOpt.bTest1 ; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 97455d9e2514..b44ee246ac41 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -33,15 +33,10 @@ #include "dbinsdlg.hxx" -#ifndef INCLUDED_MEMORY #include <memory> -#define INCLUDED_MEMORY -#endif -#ifndef INCLUDED_FLOAT_H #include <float.h> -#define INCLUDED_FLOAT_H -#endif + #include <hintids.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -65,9 +60,7 @@ #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> -#ifndef __SV_MNEMONIC_HXX #include <vcl/mnemonic.hxx> -#endif #include <svl/style.hxx> #include <svl/zformat.hxx> #include <svx/htmlmode.hxx> @@ -78,24 +71,16 @@ #include <editeng/boxitem.hxx> #include <svx/rulritem.hxx> #include <swdbtoolsclient.hxx> -#ifndef _SWTABLEREP_HXX //autogen #include <tabledlg.hxx> -#endif #include <fmtclds.hxx> #include <tabcol.hxx> #include <uiitems.hxx> #include <viewopt.hxx> #include <uitool.hxx> #include <wrtsh.hxx> -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif -#ifndef _DBMGR_HXX #include <dbmgr.hxx> -#endif #include <tblafmt.hxx> #include <cellatr.hxx> #include <swtable.hxx> @@ -108,19 +93,11 @@ #include <poolfmt.hxx> #include <crsskip.hxx> -#ifndef _DBINSDLG_HRC #include <dbinsdlg.hrc> -#endif -#ifndef _DBUI_HRC #include <dbui.hrc> -#endif -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _HELPID_H #include <helpid.h> -#endif #include <cfgid.h> #include <SwStyleNameMapper.hxx> #include <comphelper/uno3.hxx> @@ -1380,8 +1357,8 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, case _DB_Column::DB_COL_FIELD: { - SwDBField* pFld = (SwDBField*)pDBCol->DB_ColumnData. - pField->Copy(); + SwDBField *const pFld = static_cast<SwDBField *>( + pDBCol->DB_ColumnData.pField->CopyField()); double nValue = DBL_MAX; Reference< XPropertySet > xColumnProps; diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 66cb07f33e9c..704172b21074 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -322,6 +322,19 @@ SwTransferable::~SwTransferable() // ----------------------------------------------------------------------- +static SwDoc * lcl_GetDoc(SwDocFac & rDocFac) +{ + SwDoc *const pDoc = rDocFac.GetDoc(); + ASSERT( pDoc, "Document not found" ); + if (pDoc) + { + pDoc->SetClipBoard( true ); + } + return pDoc; +} + +// ----------------------------------------------------------------------- + void SwTransferable::ObjectReleased() { SwModule *pMod = SW_MOD(); @@ -443,7 +456,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) } pClpDocFac = new SwDocFac; - SwDoc* pTmpDoc = pClpDocFac->GetDoc(); + SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen @@ -530,8 +543,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) case SOT_FORMATSTR_ID_DRAWING: { - SwDoc *pDoc = pClpDocFac->GetDoc(); - ASSERT( pDoc, "Document not found" ); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); bOK = SetObject( pDoc->GetDrawModel(), SWTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor ); } @@ -539,21 +551,22 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) case SOT_FORMAT_STRING: { - SwDoc* pDoc = pClpDocFac->GetDoc(); - ASSERT( pDoc, "Document not found" ); - pDoc->SetClipBoard( true ); - bOK = SetObject( pDoc, - SWTRANSFER_OBJECTTYPE_STRING, rFlavor ); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_STRING, rFlavor ); } break; case SOT_FORMAT_RTF: - bOK = SetObject( pClpDocFac->GetDoc(), - SWTRANSFER_OBJECTTYPE_RTF, rFlavor ); + { + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_RTF, rFlavor ); + } break; case SOT_FORMATSTR_ID_HTML: - bOK = SetObject( pClpDocFac->GetDoc(), - SWTRANSFER_OBJECTTYPE_HTML, rFlavor ); + { + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_HTML, rFlavor ); + } break; case SOT_FORMATSTR_ID_SVXB: @@ -597,7 +610,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) // default: if( !aDocShellRef.Is() ) { - SwDoc *pDoc = pClpDocFac->GetDoc(); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); SwDocShell* pNewDocSh = new SwDocShell( pDoc, SFX_CREATE_MODE_EMBEDDED ); aDocShellRef = pNewDocSh; @@ -805,7 +818,8 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) pOrigGrf = pClpBitmap; pClpDocFac = new SwDocFac; - pWrtShell->Copy( pClpDocFac->GetDoc() ); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + pWrtShell->Copy( pDoc ); if (pOrigGrf && !pOrigGrf->GetBitmap().IsEmpty()) AddFormat( SOT_FORMATSTR_ID_SVXB ); @@ -827,7 +841,7 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) else if ( nSelection == nsSelectionType::SEL_OLE ) { pClpDocFac = new SwDocFac; - SwDoc *pDoc = pClpDocFac->GetDoc(); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); aDocShellRef = new SwDocShell( pDoc, SFX_CREATE_MODE_EMBEDDED); aDocShellRef->DoInitNew( NULL ); pWrtShell->Copy( pDoc ); @@ -857,8 +871,7 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) if( pWrtShell->IsAddMode() && pWrtShell->SwCrsrShell::HasSelection() ) pWrtShell->CreateCrsr(); - SwDoc* pTmpDoc = pClpDocFac->GetDoc(); - pTmpDoc->SetClipBoard( true ); + SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen @@ -1017,7 +1030,8 @@ int SwTransferable::CalculateAndCopy() String aStr( pWrtShell->Calculate() ); pClpDocFac = new SwDocFac; - pWrtShell->Copy( pClpDocFac->GetDoc(), &aStr); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + pWrtShell->Copy(pDoc, & aStr); eBufferType = TRNSFR_DOCUMENT; AddFormat( FORMAT_STRING ); @@ -1037,7 +1051,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, SwWait aWait( *pWrtShell->GetView().GetDocShell(), TRUE ); pClpDocFac = new SwDocFac; - SwDoc* pCDoc = pClpDocFac->GetDoc(); + SwDoc *const pCDoc = lcl_GetDoc(*pClpDocFac); SwNodes& rNds = pCDoc->GetNodes(); SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() ); diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx index 61d4884157cf..829c79373a61 100644 --- a/sw/source/ui/docvw/SidebarTxtControl.cxx +++ b/sw/source/ui/docvw/SidebarTxtControl.cxx @@ -340,26 +340,32 @@ void SidebarTxtControl::Command( const CommandEvent& rCEvt ) } else { - SfxPopupMenuManager* aMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); - ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) ); + SfxPopupMenuManager* pMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); + ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) ); { - XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); + XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor()); aText = aRewriter.Apply(aText); - ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); + ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); } + Point aPos; if (rCEvt.IsMouseEvent()) - ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel()); + aPos = rCEvt.GetMousePosPixel(); else { const Size aSize = GetSizePixel(); - const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); - ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos); + aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); } - delete aMgr; + + //!! call different Execute function to get rid of the new thesaurus sub menu + //!! pointer created in the call to Popup. + //!! Otherwise we would have a memory leak (see also #i107205#) + //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos ); + pMgr->Execute( aPos, this ); + delete pMgr; } } else diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index 763504c75db6..be201c32c24e 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -35,9 +35,7 @@ #include <stdio.h> #endif -#ifndef _HELP_HXX //autogen #include <vcl/help.hxx> -#endif #include <svl/stritem.hxx> #include <unotools/securityoptions.hxx> #include <tools/urlobj.hxx> @@ -46,24 +44,15 @@ #include <editeng/flditem.hxx> #include <svl/urihelper.hxx> #include <svx/svdotext.hxx> -#ifndef _OUTLINER_HXX //autogen -#define _EEITEMID_HXX #include <editeng/outliner.hxx> -#endif #include <svl/itemiter.hxx> #include <svx/svdview.hxx> #include <svx/svdpagv.hxx> #include <swmodule.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <edtwin.hxx> #include <dpage.hxx> #include <shellres.hxx> @@ -80,12 +69,8 @@ #include <txttxmrk.hxx> #include <uitool.hxx> #include <viewopt.hxx> -#ifndef _DOCVW_HRC #include <docvw.hrc> -#endif -#ifndef _UTLUI_HRC #include <utlui.hrc> -#endif #include <PostItMgr.hxx> #include <fmtfld.hxx> @@ -319,7 +304,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) { USHORT nOldSubType = pFld->GetSubType(); ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD); - sTxt = pFld->Expand(); + sTxt = + pFld->ExpandField(rSh.GetDoc()->IsClipBoard()); ((SwField*)pFld)->SetSubType(nOldSubType); } break; diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 3499c8875093..95001f897702 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -1435,7 +1435,7 @@ void SwFldMgr::UpdateCurFld(ULONG nFormat, } else { - pTmpFld = pCurFld->Copy(); + pTmpFld = pCurFld->CopyField(); bDelete = true; } diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 39a6a98d764b..265a53dc6646 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -42,28 +42,16 @@ #include <fmtfld.hxx> #include <viewopt.hxx> #include <fldedt.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <swmodule.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> #include <expfld.hxx> -#ifndef _FLDTDLG_HXX #include <fldtdlg.hxx> -#endif -#ifndef _FLDPAGE_HXX #include <fldpage.hxx> -#endif #include <docufld.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <sfx2/bindings.hxx> using namespace ::com::sun::star; @@ -218,7 +206,7 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1, } else // Feld aendern { - SwField * pTmpFld = m_pCurFld->Copy(); + SwField *const pTmpFld = m_pCurFld->CopyField(); String sPar1(rPar1); String sPar2(rPar2); diff --git a/sw/source/ui/inc/langhelper.hxx b/sw/source/ui/inc/langhelper.hxx index 0d05c930284a..3ff795d83f56 100755 --- a/sw/source/ui/inc/langhelper.hxx +++ b/sw/source/ui/inc/langhelper.hxx @@ -31,31 +31,37 @@ class SwWrtShell; class SwView; class EditEngine; class EditView; +class OutlinerView; class SfxItemSet; struct ESelection; namespace SwLangHelper { - extern USHORT GetLanguageStatus(OutlinerView* pOLV,SfxItemSet& rSet); - extern bool SetLanguageStatus(OutlinerView* pOLV,SfxRequest &rReq,SwView &rView,SwWrtShell &rSh); + extern USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ); + extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh ); - extern void SetLanguage(SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet); - extern void SetLanguage(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet); - extern void SetLanguage_None(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); - extern void SetLanguage_None(SwWrtShell &rWrtSh,bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); +// extern void SetLanguage( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ); +// extern void SetLanguage_None( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection ); +// extern void ResetLanguages( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection ); + extern void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection ); // document extern void SelectCurrentPara( SwWrtShell &rWrtSh ); // EditView extern void SelectPara( EditView &rEditView, const ESelection &rCurSel ); - extern String GetTextForLanguageGuessing(EditEngine* rEditEngine, ESelection aDocSelection ); + extern String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection ); extern String GetTextForLanguageGuessing( SwWrtShell &rSh ); extern LanguageType GetLanguage( SfxItemSet aSet, USHORT nLangWhichId ); extern LanguageType GetLanguage( SwWrtShell &rSh, USHORT nLangWhichId ); - extern LanguageType GetCurrentLanguage(SfxItemSet aSet,USHORT nScriptType ); + extern LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType ); extern LanguageType GetCurrentLanguage( SwWrtShell &rSh ); } diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx index 3bc0eb02d3b6..ef6a26e73f67 100644 --- a/sw/source/ui/inc/olmenu.hxx +++ b/sw/source/ui/inc/olmenu.hxx @@ -51,23 +51,22 @@ class SwSpellPopup : public PopupMenu ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt; ::com::sun::star::uno::Sequence< rtl::OUString > aSuggestions; - LanguageType nCheckedLanguage; + LanguageType nCheckedLanguage; LanguageType nGuessLangWord; LanguageType nGuessLangPara; - USHORT nNumLanguageTextEntries; - USHORT nNumLanguageParaEntries; - USHORT nNumLanguageDocEntries; std::map< sal_Int16, ::rtl::OUString > aLangTable_Text; std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph; - std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; +// std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; bool bGrammarResults; // show grammar results? Or show spellcheck results? Image aInfo16; - USHORT fillLangPopupMenu( PopupMenu *pPopupMenu , USHORT Lang_Start, ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq,SwWrtShell* pWrtSh, USHORT nLangTable); + void fillLangPopupMenu( PopupMenu *pPopupMenu, USHORT nLangStart, + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq, SwWrtShell* pWrtSh, + std::map< sal_Int16, ::rtl::OUString > &rLangTable ); using PopupMenu::Execute; diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index 84b3309f70bc..a239f13f1ec2 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -26,12 +26,10 @@ ************************************************************************/ #ifndef _SWDTFLVR_HXX #define _SWDTFLVR_HXX -#ifndef _TRANSFER_HXX #include <sfx2/objsh.hxx> #include <svtools/transfer.hxx> -#endif #include <vcl/graph.hxx> #include <sfx2/lnkbase.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 0c16e8bf132e..c59bb1535bad 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -437,6 +437,12 @@ public: virtual USHORT PrepareClose( BOOL bUI = TRUE, BOOL bForBrowsing = FALSE ); virtual void MarginChanged(); + // replace word/selection with text from the thesaurus + // (this code has special handling for "in word" character) + void InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bValidSelection ); + bool IsValidSelectionForThesaurus() const; + String GetThesaurusLookUpText( bool bSelection ) const; + // Shell sofort wechseln -> fuer GetSelectionObject void StopShellTimer(); diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 9ebfd8c8cf36..934cfc19e22b 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -28,85 +28,84 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> +#include "SwRewriter.hxx" +#include "chrdlg.hrc" +#include "cmdid.h" +#include "comcore.hrc" +#include "crsskip.hxx" +#include "doc.hxx" +#include "docsh.hxx" //CheckSpellChanges +#include "edtwin.hxx" +#include "helpid.h" +#include "hintids.hxx" +#include "langhelper.hxx" +#include "ndtxt.hxx" +#include "olmenu.hrc" +#include "olmenu.hxx" +#include "swabstdlg.hxx" +#include "swmodule.hxx" +#include "swtypes.hxx" +#include "swundo.hxx" +#include "uitool.hxx" +#include "undobj.hxx" +#include "unomid.h" +#include "view.hxx" +#include "viewopt.hxx" +#include "wrtsh.hxx" +#include "wview.hxx" +#include "swabstdlg.hxx" +#include "chrdlg.hrc" + #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> #endif -#include <unotools/lingucfg.hxx> -#include <unotools/linguprops.hxx> -#include <svtools/filter.hxx> -#include <editeng/svxacorr.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/imagemgr.hxx> -#include <osl/file.hxx> -#include <rtl/string.hxx> +#include <comphelper/processfactory.hxx> +#include <editeng/acorrcfg.hxx> +#include <editeng/svxacorr.hxx> +#include <editeng/langitem.hxx> +#include <editeng/splwrap.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/unolingu.hxx> #include <i18npool/mslangid.hxx> #include <linguistic/lngprops.hxx> #include <linguistic/misc.hxx> -#include <comphelper/processfactory.hxx> -#include <editeng/unolingu.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/linguistic2/XSpellChecker1.hpp> -#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> -#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/i18n/ScriptType.hpp> -#include <svx/dlgutil.hxx> +#include <osl/file.hxx> +#include <rtl/string.hxx> +#include <svtools/filter.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/imagemgr.hxx> +#include <sfx2/request.hxx> +#include <sfx2/sfxdlg.hxx> #include <svl/itemset.hxx> -#include <editeng/langitem.hxx> -#include <editeng/splwrap.hxx> -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> -#include <unotools/lingucfg.hxx> -#include <editeng/acorrcfg.hxx> -#include <swmodule.hxx> -#include <cmdid.h> -#include <helpid.h> -#include <swtypes.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <docsh.hxx> //CheckSpellChanges -#include <olmenu.hxx> -#include <swundo.hxx> -#include <crsskip.hxx> -#include <ndtxt.hxx> -#include <olmenu.hrc> -#include <doc.hxx> - -// -> #111827# -#include <SwRewriter.hxx> -#include <comcore.hrc> -#include <undobj.hxx> -// <- #111827# - -#include <unomid.h> #include <svl/languageoptions.hxx> -#include <map> -#include <svtools/langtab.hxx> -#include <com/sun/star/document/XDocumentLanguages.hpp> -#include <edtwin.hxx> -#include <sfx2/sfxdlg.hxx> -#include "swabstdlg.hxx" -#include "chrdlg.hrc" -#include <editeng/brshitem.hxx> #include <svl/stritem.hxx> -#include <viewopt.hxx> -#include <uitool.hxx> +#include <svtools/filter.hxx> +#include <svtools/langtab.hxx> +#include <svx/dlgutil.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/linguprops.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> -#include <wview.hxx> -#include <sfx2/request.hxx> +#include <map> -#include <vcl/msgbox.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/document/XDocumentLanguages.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> +#include <com/sun/star/linguistic2/XSpellChecker1.hpp> +#include <com/sun/star/uno/Any.hxx> -#include <langhelper.hxx> using namespace ::com::sun::star; using ::rtl::OUString; @@ -214,63 +213,59 @@ inline bool lcl_checkScriptType( sal_Int16 nScriptType, LanguageType nLang ) return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); } -USHORT SwSpellPopup::fillLangPopupMenu( +void SwSpellPopup::fillLangPopupMenu( PopupMenu *pPopupMenu, - USHORT Lang_Start, - uno::Sequence< ::rtl::OUString > aSeq, + USHORT nLangItemIdStart, + uno::Sequence< OUString > aSeq, SwWrtShell* pWrtSh, - USHORT nLangTable ) + std::map< sal_Int16, ::rtl::OUString > &rLangTable ) { if (!pPopupMenu) - return 0; - - //Reference< awt::XMenuExtended > m_xMenuExtended( m_xPopupMenu, UNO_QUERY ); - std::map< ::rtl::OUString, ::rtl::OUString > LangItems; + return; SvtLanguageTable aLanguageTable; - USHORT nItemId = Lang_Start; - rtl::OUString curLang = aSeq[0]; - USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); - rtl::OUString keyboardLang = aSeq[2]; - rtl::OUString guessLang = aSeq[3]; - - //1--add current language - if(curLang!=OUString::createFromAscii("")) - { - LangItems[curLang]=curLang; - } - SvtLanguageTable aLangTable; + // set of languages to be displayed in the sub menus + std::set< OUString > aLangItems; + + OUString aCurLang( aSeq[0] ); + USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); + OUString aKeyboardLang( aSeq[2] ); + OUString aGuessedTextLang( aSeq[3] ); + + if (aCurLang != OUString() && + LANGUAGE_DONTKNOW != aLanguageTable.GetType( aCurLang )) + aLangItems.insert( aCurLang ); + //2--System - const AllSettings& rAllSettings=Application::GetSettings(); + const AllSettings& rAllSettings = Application::GetSettings(); LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if(rSystemLanguage!=LANGUAGE_DONTKNOW) + if (rSystemLanguage != LANGUAGE_DONTKNOW) { - if (lcl_checkScriptType(nScriptType,rSystemLanguage )) - LangItems[OUString(aLangTable.GetString(rSystemLanguage))]=OUString(aLangTable.GetString(rSystemLanguage)); + if (lcl_checkScriptType( nScriptType, rSystemLanguage )) + aLangItems.insert( aLanguageTable.GetString(rSystemLanguage) ); } //3--UI LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if(rUILanguage!=LANGUAGE_DONTKNOW) + if (rUILanguage != LANGUAGE_DONTKNOW) { if (lcl_checkScriptType(nScriptType, rUILanguage )) - LangItems[OUString(aLangTable.GetString(rUILanguage))]=OUString(aLangTable.GetString(rUILanguage)); + aLangItems.insert( aLanguageTable.GetString(rUILanguage) ); } //4--guessed language - if(guessLang!=OUString::createFromAscii("")) + if (aGuessedTextLang.getLength() > 0) { - if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(guessLang))) - LangItems[guessLang]=guessLang; + if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aGuessedTextLang))) + aLangItems.insert( aGuessedTextLang ); } - //5--keyboard language - if(keyboardLang!=OUString::createFromAscii("")) + if (aKeyboardLang.getLength() > 0) { - if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(keyboardLang))) - LangItems[keyboardLang]=keyboardLang; + if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aKeyboardLang))) + aLangItems.insert( aKeyboardLang ); } //6--all languages used in current document @@ -278,74 +273,57 @@ USHORT SwSpellPopup::fillLangPopupMenu( uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY ); if ( xController.is() ) xModel = xController->getModel(); - uno::Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, uno::UNO_QUERY ); - /*the description of nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 + /*the description of nScriptType flags + LATIN : 0x0001 + ASIAN : 0x0002 + COMPLEX: 0x0004 */ - - sal_Int16 nCount=7; - if(xDocumentLanguages.is()) + const sal_Int16 nMaxCount = 7; + if (xDocumentLanguages.is()) { - uno::Sequence< lang::Locale > rLocales(xDocumentLanguages->getDocumentLanguages(nScriptType,nCount)); - if(rLocales.getLength()>0) + uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount ) ); + if (rLocales.getLength() > 0) { - for(USHORT i = 0; i<rLocales.getLength();++i) + for (USHORT i = 0; i < rLocales.getLength(); ++i) { - if (LangItems.size()==7) + if (aLangItems.size() == (size_t)nMaxCount) break; - const lang::Locale& rLocale=rLocales[i]; - if(lcl_checkScriptType(nScriptType, aLanguageTable.GetType(rLocale.Language))) - LangItems[ rtl::OUString(rLocale.Language)]=OUString(rLocale.Language); + const lang::Locale& rLocale = rLocales[i]; + if (lcl_checkScriptType( nScriptType, aLanguageTable.GetType( rLocale.Language ))) + aLangItems.insert( rLocale.Language ); } } } - bool bMultipleLanguages = (nLangTable != 0) || (curLang.compareToAscii( "*" ) == 0); - bool bNothingSelected = true; - MenuItemBits nMenuItemStyle = !bMultipleLanguages ? MIB_RADIOCHECK : 0; - for (std::map< rtl::OUString, rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it) + + USHORT nItemId = nLangItemIdStart; + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - rtl::OUString aEntryTxt( it->first ); - if (aEntryTxt != rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - aEntryTxt != rtl::OUString::createFromAscii("*") && - aEntryTxt.getLength() > 0) + OUString aEntryTxt( *it ); + if (aEntryTxt != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + aEntryTxt != sAsterix && + aEntryTxt != sEmpty) { - ++nItemId; - if (nLangTable == 0) // language for selection - aLangTable_Text[nItemId] = aEntryTxt; - else if (nLangTable == 1) // language for paragraph - aLangTable_Paragraph[nItemId] = aEntryTxt; - else if (nLangTable == 2) // language for document - aLangTable_Document[nItemId] = aEntryTxt; - - pPopupMenu->InsertItem( nItemId, aEntryTxt, nMenuItemStyle ); - if ((nLangTable == 0) && (aEntryTxt == curLang)) + DBG_ASSERT( nLangItemIdStart <= nItemId && nItemId <= nLangItemIdStart + MN_MAX_NUM_LANG, + "nItemId outside of expected range!" ); + pPopupMenu->InsertItem( nItemId, aEntryTxt, MIB_RADIOCHECK ); + if (aEntryTxt == aCurLang) { //make a check mark for the current language pPopupMenu->CheckItem( nItemId, TRUE ); - bNothingSelected = false; } + rLangTable[ nItemId ] = aEntryTxt; + ++nItemId; } } - //7--none - nItemId++; - pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), nMenuItemStyle ); - if (bNothingSelected && !bMultipleLanguages) - pPopupMenu->CheckItem( nItemId, TRUE ); - - //More... - nItemId++; - pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )) ); - - return nItemId - Lang_Start; // return number of inserted entries + pPopupMenu->InsertItem( nLangItemIdStart + MN_NONE_OFFSET, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK ); + pPopupMenu->InsertItem( nLangItemIdStart + MN_RESET_OFFSET, String(SW_RES( STR_RESET_TO_DEFAULT_LANGUAGE )), MIB_RADIOCHECK ); + pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK ); } @@ -368,22 +346,22 @@ static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) } -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) +OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) { - ::rtl::OUString aLabel; + OUString aLabel; if ( aCmdURL.getLength() ) { try { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); + uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); if ( xNameAccess.is() ) { uno::Reference< container::XNameAccess > xUICommandLabels; - const ::rtl::OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); + const OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); uno::Any a = xNameAccess->getByName( aModule ); uno::Reference< container::XNameAccess > xUICommands; a >>= xUICommandLabels; - rtl::OUString aStr; + OUString aStr; uno::Sequence< beans::PropertyValue > aPropSeq; a = xUICommandLabels->getByName( aCmdURL ); if ( a >>= aPropSeq ) @@ -448,25 +426,28 @@ bGrammarResults(false) InsertSeparator(0); bEnable = sal_True; - for( sal_uInt16 i = 0, nPos = 1, nId = MN_AUTOCORR_START + 1; - i < nStringCount; ++i, ++nPos, ++nId ) + USHORT nAutoCorrItemId = MN_AUTOCORR_START; + USHORT nItemId = MN_SUGGESTION_START; + for (USHORT i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; - InsertItem( nPos, aEntry, 0, i ); - SetHelpId( nPos, HID_LINGU_REPLACE); - + InsertItem( nItemId, aEntry, 0, i ); + SetHelpId( nItemId, HID_LINGU_REPLACE); if (aSuggestionImageUrl.getLength() > 0) - SetItemImage( nPos, aImage ); + SetItemImage( nItemId, aImage ); + + pMenu->InsertItem( nAutoCorrItemId, aEntry ); + pMenu->SetHelpId( nAutoCorrItemId, HID_LINGU_AUTOCORR); - pMenu->InsertItem( nId, aEntry ); - pMenu->SetHelpId( nPos, HID_LINGU_AUTOCORR); + ++nAutoCorrItemId; + ++nItemId; } } OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); - SetItemText( MN_SPELLING, aSpellingAndGrammar ); - USHORT nItemPos = GetItemPos( MN_IGNORE ); + SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE_WORD ); InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); @@ -489,11 +470,9 @@ bGrammarResults(false) nGuessLangPara = nGuessLangWord; } - pMenu = GetPopupMenu(MN_INSERT); - - bEnable = FALSE; // enable MN_INSERT? - + pMenu = GetPopupMenu(MN_ADD_TO_DIC); pMenu->CreateAutoMnemonics(); + bEnable = FALSE; // enable MN_ADD_TO_DIC? uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); if (xDicList.is()) { @@ -508,6 +487,7 @@ bGrammarResults(false) const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray(); USHORT nDicCount = static_cast< USHORT >(aDics.getLength()); + USHORT nItemId = MN_DICTIONARIES_START; for( USHORT i = 0; i < nDicCount; i++ ) { uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); @@ -523,8 +503,7 @@ bGrammarResults(false) { // the extra 1 is because of the (possible) external // linguistic entry above - USHORT nPos = MN_INSERT_START + i + 1; - pMenu->InsertItem( nPos, xDicTmp->getName() ); + pMenu->InsertItem( nItemId, xDicTmp->getName() ); bEnable = sal_True; uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); @@ -535,18 +514,20 @@ bGrammarResults(false) if (aDictionaryImageUrl.getLength() > 0) { Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); - pMenu->SetItemImage( nPos, aImage ); + pMenu->SetItemImage( nItemId, aImage ); } } + + ++nItemId; } } } - EnableItem( MN_INSERT, bEnable ); + EnableItem( MN_ADD_TO_DIC, bEnable ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) ); - SvtLanguageTable aLangTable; + SvtLanguageTable aLanguageTable; // get keyboard language String aKeyboardLang; @@ -554,39 +535,40 @@ bGrammarResults(false) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) - aKeyboardLang = aLangTable.GetString( nLang ); + aKeyboardLang = aLanguageTable.GetString( nLang ); // get the language that is in use const String aMultipleLanguages = String::CreateFromAscii("*"); String aCurrentLang = aMultipleLanguages; nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh ); if (nLang != LANGUAGE_DONTKNOW) - aCurrentLang = aLangTable.GetString( nLang ); + aCurrentLang = aLanguageTable.GetString( nLang ); // build sequence for status value - uno::Sequence< ::rtl::OUString > aSeq( 4 ); + uno::Sequence< OUString > aSeq( 4 ); aSeq[0] = aCurrentLang; aSeq[1] = aScriptTypesInUse; aSeq[2] = aKeyboardLang; - aSeq[3] = aLangTable.GetString(nGuessLangWord); + aSeq[3] = aLanguageTable.GetString(nGuessLangWord); - pMenu = GetPopupMenu(MN_LANGUAGE_SELECTION); - nNumLanguageTextEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_SELECTION_START, aSeq, pWrtSh, 0 ); - EnableItem( MN_LANGUAGE_SELECTION, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text ); + EnableItem( MN_SET_LANGUAGE_SELECTION, true ); - pMenu = GetPopupMenu(MN_LANGUAGE_PARAGRAPH); - nNumLanguageParaEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, 1 ); - EnableItem( MN_LANGUAGE_PARAGRAPH, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph ); + EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true ); /* - pMenu = GetPopupMenu(MN_LANGUAGE_ALL_TEXT); - nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); - EnableItem( MN_LANGUAGE_ALL_TEXT, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document ); + EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true ); */ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, - ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); + ////////////////////////////////////////////////////////////////////////////////// RemoveDisabledEntries( TRUE, TRUE ); @@ -601,7 +583,7 @@ SwSpellPopup::SwSpellPopup( SwWrtShell *pWrtSh, const linguistic2::ProofreadingResult &rResult, sal_Int32 nErrorInResult, - const uno::Sequence< rtl::OUString > &rSuggestions, + const uno::Sequence< OUString > &rSuggestions, const String &rParaText ) : PopupMenu( SW_RES(MN_SPELL_POPUP) ), pSh( pWrtSh ), @@ -611,13 +593,11 @@ aInfo16( SW_RES(IMG_INFO_16) ) { nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale ); - sal_Int16 nItemId = 1; - sal_Int16 nPos = 0; + USHORT nPos = 0; OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment ); InsertSeparator( nPos++ ); - InsertItem( nItemId, aMessageText, MIB_NOSELECT, nPos++ ); - SetItemImage( nItemId, aInfo16 ); - ++nItemId; + InsertItem( MN_SHORT_COMMENT, aMessageText, MIB_NOSELECT, nPos++ ); + SetItemImage( MN_SHORT_COMMENT, aInfo16 ); CreateAutoMnemonics(); @@ -634,12 +614,12 @@ aInfo16( SW_RES(IMG_INFO_16) ) aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); } + USHORT nItemId = MN_SUGGESTION_START; for (sal_uInt16 i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; InsertItem( nItemId, aEntry, 0, nPos++ ); SetHelpId( nItemId, HID_LINGU_REPLACE ); - if (aSuggestionImageUrl.getLength() > 0) SetItemImage( nItemId, aImage ); @@ -650,8 +630,8 @@ aInfo16( SW_RES(IMG_INFO_16) ) OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); - SetItemText( MN_SPELLING, aSpellingAndGrammar ); - USHORT nItemPos = GetItemPos( MN_IGNORE ); + SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE_WORD ); InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); @@ -674,13 +654,13 @@ aInfo16( SW_RES(IMG_INFO_16) ) nGuessLangPara = nGuessLangWord; } - EnableItem( MN_IGNORE, false ); - EnableItem( MN_INSERT, false ); + EnableItem( MN_IGNORE_WORD, false ); + EnableItem( MN_ADD_TO_DIC, false ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) ); - SvtLanguageTable aLangTable; + SvtLanguageTable aLanguageTable; // get keyboard language String aKeyboardLang; @@ -688,39 +668,39 @@ aInfo16( SW_RES(IMG_INFO_16) ) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) - aKeyboardLang = aLangTable.GetString( nLang ); + aKeyboardLang = aLanguageTable.GetString( nLang ); // get the language that is in use const String aMultipleLanguages = String::CreateFromAscii("*"); String aCurrentLang = aMultipleLanguages; nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh ); if (nLang != LANGUAGE_DONTKNOW) - aCurrentLang = aLangTable.GetString( nLang ); + aCurrentLang = aLanguageTable.GetString( nLang ); // build sequence for status value - uno::Sequence< ::rtl::OUString > aSeq( 4 ); + uno::Sequence< OUString > aSeq( 4 ); aSeq[0] = aCurrentLang; aSeq[1] = aScriptTypesInUse; aSeq[2] = aKeyboardLang; - aSeq[3] = aLangTable.GetString(nGuessLangWord); + aSeq[3] = aLanguageTable.GetString(nGuessLangWord); - PopupMenu *pMenu = GetPopupMenu(MN_LANGUAGE_SELECTION); - nNumLanguageTextEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_SELECTION_START, aSeq, pWrtSh, 0 ); - EnableItem( MN_LANGUAGE_SELECTION, true ); + PopupMenu *pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text ); + EnableItem( MN_SET_LANGUAGE_SELECTION, true ); - pMenu = GetPopupMenu(MN_LANGUAGE_PARAGRAPH); - nNumLanguageParaEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, 1 ); - EnableItem( MN_LANGUAGE_PARAGRAPH, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph ); + EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true ); /* - pMenu = GetPopupMenu(MN_LANGUAGE_ALL_TEXT); - nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); - EnableItem( MN_LANGUAGE_ALL_TEXT, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document ); + EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true ); */ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, - ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); ////////////////////////////////////////////////////////////////////////////////// @@ -743,25 +723,23 @@ sal_uInt16 SwSpellPopup::Execute( const Rectangle& rWordPos, Window* pWin ) -----------------------------------------------------------------------*/ void SwSpellPopup::Execute( USHORT nId ) { - if (bGrammarResults && nId == 1) - return; // nothing to do since it is the error message (short comment) + if (nId == USHRT_MAX) + return; - sal_Bool bAutoCorr = sal_False; - if( nId > MN_AUTOCORR_START && nId < MN_LANGUAGE_SELECTION_START && nId != USHRT_MAX ) - { - nId -= MN_AUTOCORR_START; - bAutoCorr = sal_True; - } + if (/*bGrammarResults && */nId == MN_SHORT_COMMENT) + return; // nothing to do since it is the error message (short comment) - if( nId && nId != USHRT_MAX) + if ((MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) || + (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END)) { - int nAltIdx = bGrammarResults ? nId - 2 : nId - 1; - if ( nAltIdx >= 0 && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is()) ) + sal_Int32 nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ? + nId - MN_SUGGESTION_START : nId - MN_AUTOCORR_START; + DBG_ASSERT( 0 <= nAltIdx && nAltIdx < aSuggestions.getLength(), "index out of range" ); + if (0 <= nAltIdx && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is())) { sal_Bool bOldIns = pSh->IsInsMode(); pSh->SetInsMode( sal_True ); - DBG_ASSERT( 0 <= nAltIdx && nAltIdx <= aSuggestions.getLength(), "index out of range"); String aTmp( aSuggestions[ nAltIdx ] ); String aOrig( bGrammarResults ? OUString() : xSpellAlt->getWord() ); @@ -780,40 +758,30 @@ void SwSpellPopup::Execute( USHORT nId ) aRewriter.AddRule(UNDO_ARG1, pSh->GetCrsrDescr()); aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS))); - { - String aTmpStr; - - aTmpStr += String(SW_RES(STR_START_QUOTE)); - aTmpStr += aTmp; - aTmpStr += String(SW_RES(STR_END_QUOTE)); - aRewriter.AddRule(UNDO_ARG3, aTmpStr); - } + String aTmpStr( SW_RES(STR_START_QUOTE) ); + aTmpStr += aTmp; + aTmpStr += String(SW_RES(STR_END_QUOTE)); + aRewriter.AddRule(UNDO_ARG3, aTmpStr); pSh->StartUndo(UNDO_UI_REPLACE, &aRewriter); pSh->StartAction(); pSh->DelLeft(); pSh->Insert( aTmp ); + /* #102505# EndAction/EndUndo moved down since insertion of temporary auto correction is now undoable two and must reside in the same undo group.*/ - // nur aufnehmen, wenn es NICHT schon in der Autokorrektur vorhanden ist SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect(); String aOrigWord( bGrammarResults ? OUString() : xSpellAlt->getWord() ) ; - String aNewWord; - if( nId ) - aNewWord = aSuggestions[ nAltIdx ]; - else - aNewWord = aOrigWord; + String aNewWord( aSuggestions[ nAltIdx ] ); SvxPrepareAutoCorrect( aOrigWord, aNewWord ); - if( bAutoCorr ) - { + if (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END) pACorr->PutText( aOrigWord, aNewWord, nCheckedLanguage ); - } /* #102505# EndAction/EndUndo moved down since insertion of temporary auto correction is now undoable two and @@ -823,180 +791,140 @@ void SwSpellPopup::Execute( USHORT nId ) pSh->SetInsMode( bOldIns ); } - else + } + else if (nId == MN_SPELLING_DLG) + { + if (bGrammarResults) + { + SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); + } + pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); { - if (nId < MN_LANGUAGE_SELECTION_START) + uno::Reference<linguistic2::XDictionaryList> xDictionaryList( SvxGetDictionaryList() ); + SvxDicListChgClamp aClamp( xDictionaryList ); + pSh->GetView().GetViewFrame()->GetDispatcher()-> + Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON ); + } + } + else if (nId == MN_IGNORE_SELECTION) + { + SwPaM *pPaM = pSh->GetCrsr(); + if (pPaM) + pSh->IgnoreGrammarErrorAt( *pPaM ); + } + else if (nId == MN_IGNORE_WORD) + { + uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); + linguistic::AddEntryToDic( xDictionary, + xSpellAlt->getWord(), sal_False, aEmptyStr, LANGUAGE_NONE ); + } + else if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) + { + OUString aWord( xSpellAlt->getWord() ); + USHORT nDicIdx = nId - MN_DICTIONARIES_START; + DBG_ASSERT( nDicIdx < aDics.getLength(), "dictionary index out of range" ); + + if (nDicIdx < aDics.getLength()) { - switch( nId ) + uno::Reference< linguistic2::XDictionary > xDic = aDics.getConstArray()[nDicIdx]; + INT16 nAddRes = linguistic::AddEntryToDic( xDic, aWord, FALSE, aEmptyStr, LANGUAGE_NONE ); + // save modified user-dictionary if it is persistent + uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); + if (xSavDic.is()) + xSavDic->store(); + + if (DIC_ERR_NONE != nAddRes + && !xDic->getEntry( aWord ).is()) { - case MN_SPELLING: - { - if (bGrammarResults) - { - SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); - } - pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); - { - uno::Reference<linguistic2::XDictionaryList> xDictionaryList( SvxGetDictionaryList() ); - SvxDicListChgClamp aClamp( xDictionaryList ); - pSh->GetView().GetViewFrame()->GetDispatcher()-> - Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON ); - } - } - break; - case MN_IGNORE_SELECTION : - { - SwPaM *pPaM = pSh->GetCrsr(); - if (pPaM) - pSh->IgnoreGrammarErrorAt( *pPaM ); - } - break; - case MN_IGNORE : - { - uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); - linguistic::AddEntryToDic( - xDictionary, - xSpellAlt->getWord(), sal_False, - aEmptyStr, LANGUAGE_NONE ); - } - break; - case MN_INSERT: - DBG_ERROR("geht noch nicht!"); - break; - case MN_LANGUAGE_WORD: - case MN_LANGUAGE_PARA: - { - pSh->StartAction(); - - if( MN_LANGUAGE_PARA == nId ) - { - if( !pSh->IsSttPara() ) - pSh->MovePara( fnParaCurr, fnParaStart ); - pSh->SwapPam(); - if( !pSh->IsEndPara() ) - pSh->MovePara( fnParaCurr, fnParaEnd ); - } - - LanguageType nLangToUse = (MN_LANGUAGE_PARA == nId) ? nGuessLangPara : nGuessLangWord; - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse ); - USHORT nResId = 0; - switch (nScriptType) - { - case SCRIPTTYPE_COMPLEX : nResId = RES_CHRATR_CTL_LANGUAGE; break; - case SCRIPTTYPE_ASIAN : nResId = RES_CHRATR_CJK_LANGUAGE; break; - default /*SCRIPTTYPE_LATIN*/: nResId = RES_CHRATR_LANGUAGE; break; - } - SfxItemSet aSet(pSh->GetAttrPool(), nResId, nResId ); - aSet.Put( SvxLanguageItem( nLangToUse, nResId ) ); - pSh->SetAttr( aSet ); - - pSh->EndAction(); - } - break; - default: - if(nId >= MN_INSERT_START ) - { - OUString aWord( xSpellAlt->getWord() ); - INT32 nDicIdx = nId - MN_INSERT_START - 1; - DBG_ASSERT( nDicIdx < aDics.getLength(), - "dictionary index out of range" ); - uno::Reference< linguistic2::XDictionary > xDic = - aDics.getConstArray()[nDicIdx]; - INT16 nAddRes = linguistic::AddEntryToDic( xDic, - aWord, FALSE, aEmptyStr, LANGUAGE_NONE ); - // save modified user-dictionary if it is persistent - uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); - if (xSavDic.is()) - xSavDic->store(); - - if (DIC_ERR_NONE != nAddRes - && !xDic->getEntry( aWord ).is()) - { - SvxDicError( - &pSh->GetView().GetViewFrame()->GetWindow(), - nAddRes ); - } - } + SvxDicError( + &pSh->GetView().GetViewFrame()->GetWindow(), + nAddRes ); } } - else - { - SfxItemSet aCoreSet( pSh->GetView().GetPool(), - RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, - RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, - RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, - 0 ); - String aNewLangTxt; - -// pSh->StartAction(); + } + else + { + // Set language for selection or for paragraph... - if (nId >= MN_LANGUAGE_SELECTION_START && nId < MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries - 1) - { - //Set language for current selection - aNewLangTxt=aLangTable_Text[nId]; - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); - } - else if (nId == MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries - 1) - { - //Set Language_None for current selection - SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); - } - else if (nId == MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries) - { - //Open Format/Character Dialog - lcl_CharDialog( *pSh, true, nId, 0, 0 ); - } - else if (nId >= MN_LANGUAGE_PARAGRAPH_START && nId < MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries - 1) - { - //Set language for current paragraph - aNewLangTxt=aLangTable_Paragraph[nId]; - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId == MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries - 1) - { - //Set Language_None for current paragraph - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId == MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries) - { - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - //Open Format/Character Dialog - lcl_CharDialog( *pSh, true, nId, 0, 0 ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId >= MN_LANGUAGE_ALL_TEXT_START && nId < MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) - { - //Set selected language as the default language - aNewLangTxt=aLangTable_Document[nId]; - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, false, aCoreSet ); - } - else if (nId == MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) - { - //Set Language_None as the default language - SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet ); - } - else if (nId == MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries) - { - // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); - pDlg->Execute(); - delete pDlg; - } - } + SfxItemSet aCoreSet( pSh->GetView().GetPool(), + RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, + RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, + RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, + 0 ); + String aNewLangTxt; -// pSh->EndAction(); + if (MN_SET_LANGUAGE_SELECTION_START <= nId && nId <= MN_SET_LANGUAGE_SELECTION_END) + { + //Set language for current selection + aNewLangTxt = aLangTable_Text[nId]; + SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); + } + else if (nId == MN_SET_SELECTION_NONE) + { + //Set Language_None for current selection + SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); + } + else if (nId == MN_SET_SELECTION_RESET) + { + //reset languages for current selection + SwLangHelper::ResetLanguages( *pSh, true ); + } + else if (nId == MN_SET_SELECTION_MORE) + { + //Open Format/Character Dialog + lcl_CharDialog( *pSh, true, nId, 0, 0 ); + } + else if (MN_SET_LANGUAGE_PARAGRAPH_START <= nId && nId <= MN_SET_LANGUAGE_PARAGRAPH_END) + { + //Set language for current paragraph + aNewLangTxt = aLangTable_Paragraph[nId]; + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_NONE) + { + //Set Language_None for current paragraph + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_RESET) + { + //reset languages for current paragraph + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::ResetLanguages( *pSh, true ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_MORE) + { + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + //Open Format/Character Dialog + lcl_CharDialog( *pSh, true, nId, 0, 0 ); + pSh->Pop( FALSE ); // restore cursor + } +#if 0 + else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) + { + //Set Language_None as the default language + SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet ); + } + else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries) + { + // open the dialog "Tools/Options/Language Settings - Language" + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if (pFact) + { + VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); + pDlg->Execute(); + delete pDlg; } } +#endif } pSh->EnterStdMode(); diff --git a/sw/source/ui/lingu/olmenu.hrc b/sw/source/ui/lingu/olmenu.hrc index 11e7b03d440b..887f8a2ad3af 100644 --- a/sw/source/ui/lingu/olmenu.hrc +++ b/sw/source/ui/lingu/olmenu.hrc @@ -30,35 +30,65 @@ #include "rcid.hrc" -#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1) -#define STR_SPELL_OK (RC_LINGU_BEGIN + 2) -#define STR_HYP_OK (RC_LINGU_BEGIN + 3) -#define STR_WORD (RC_LINGU_BEGIN + 4) -#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5) -#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) -#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) -#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8) +#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1) +#define STR_SPELL_OK (RC_LINGU_BEGIN + 2) +#define STR_HYP_OK (RC_LINGU_BEGIN + 3) +#define STR_WORD (RC_LINGU_BEGIN + 4) +#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5) +#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) +#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) +#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8) +#define STR_RESET_TO_DEFAULT_LANGUAGE (RC_LINGU_BEGIN + 9) -#define IMG_INFO_16 (RC_LINGU_BEGIN + 8) +#define IMG_INFO_16 (RC_LINGU_BEGIN + 100) //! Don't change these values. You may break context menu modifying extensions! -#define MN_SPELLING 100 -#define MN_IGNORE_SELECTION 101 -#define MN_IGNORE 102 -#define MN_INSERT 103 -#define MN_AUTOCORR 104 -#define MN_LANGUAGE_WORD 105 -#define MN_LANGUAGE_PARA 106 -#define MN_LANGUAGE_SELECTION 107 -#define MN_LANGUAGE_PARAGRAPH 108 -#define MN_LANGUAGE_ALL_TEXT 109 - -#define MN_INSERT_START 500 -#define MN_AUTOCORR_START 900 - -#define MN_LANGUAGE_SELECTION_START 1170 -#define MN_LANGUAGE_PARAGRAPH_START 1270 -#define MN_LANGUAGE_ALL_TEXT_START 1370 +#define MN_SPELLING_DLG 200 +#define MN_IGNORE_SELECTION 201 +#define MN_IGNORE_WORD 202 +#define MN_ADD_TO_DIC 203 +#define MN_AUTOCORR 204 +#define MN_SET_LANGUAGE_SELECTION 205 +#define MN_SET_LANGUAGE_PARAGRAPH 206 +#define MN_SET_LANGUAGE_ALL_TEXT 207 +#define MN_SHORT_COMMENT 208 + +// id range for dictionaries sub menu +#define MN_DICTIONARIES_START 300 +#define MN_DICTIONARIES_END (MN_DICTIONARIES_START + 99) + +// id range for suggestions from spell and grammar checker +#define MN_SUGGESTION_START 500 +#define MN_SUGGESTION_END (MN_SUGGESTION_START + MN_MAX_NUM_LANG) + +// id range for auto correction sub menu entries +#define MN_AUTOCORR_START 700 +#define MN_AUTOCORR_END (MN_AUTOCORR_START + MN_MAX_NUM_LANG) + +// max number of language entries sub menus +#define MN_MAX_NUM_LANG 99 + +#define MN_NONE_OFFSET (MN_MAX_NUM_LANG + 1) +#define MN_RESET_OFFSET (MN_MAX_NUM_LANG + 2) +#define MN_MORE_OFFSET (MN_MAX_NUM_LANG + 3) + +// id range for 'set language for selection' sub menu entries +#define MN_SET_LANGUAGE_SELECTION_START 900 +#define MN_SET_LANGUAGE_SELECTION_END (MN_SET_LANGUAGE_SELECTION_START + MN_MAX_NUM_LANG) +#define MN_SET_SELECTION_NONE (MN_SET_LANGUAGE_SELECTION_START + MN_NONE_OFFSET) +#define MN_SET_SELECTION_RESET (MN_SET_LANGUAGE_SELECTION_START + MN_RESET_OFFSET) +#define MN_SET_SELECTION_MORE (MN_SET_LANGUAGE_SELECTION_START + MN_MORE_OFFSET) + +// id range for 'set language for paragraph' sub menu entries +#define MN_SET_LANGUAGE_PARAGRAPH_START 1100 +#define MN_SET_LANGUAGE_PARAGRAPH_END (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MAX_NUM_LANG) +#define MN_SET_PARA_NONE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_NONE_OFFSET) +#define MN_SET_PARA_RESET (MN_SET_LANGUAGE_PARAGRAPH_START + MN_RESET_OFFSET) +#define MN_SET_PARA_MORE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MORE_OFFSET) + +// id range for 'set language for all text' sub menu entries +#define MN_SET_LANGUAGE_ALL_TEXT_START 1300 +#define MN_SET_LANGUAGE_ALL_TEXT_END (MN_SET_LANGUAGE_ALL_TEXT_START + MN_MAX_NUM_LANG) #endif diff --git a/sw/source/ui/lingu/olmenu.src b/sw/source/ui/lingu/olmenu.src index 487215c2bff6..b8d9124d2e52 100644 --- a/sw/source/ui/lingu/olmenu.src +++ b/sw/source/ui/lingu/olmenu.src @@ -38,13 +38,13 @@ Menu MN_SPELL_POPUP { MenuItem { - Identifier = MN_IGNORE ; + Identifier = MN_IGNORE_WORD ; HelpID = HID_LINGU_IGNORE_WORD ; Text [ en-US ] = "Ignore All" ; }; MenuItem { - Identifier = MN_INSERT ; + Identifier = MN_ADD_TO_DIC ; HelpID = HID_LINGU_ADD_WORD ; SubMenu = Menu { @@ -62,14 +62,14 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_SPELLING ; + Identifier = MN_SPELLING_DLG ; HelpID = HID_LINGU_SPELLING_DLG ; Text [ en-US ] = "~Spellcheck..." ; }; SEPARATOR MenuItem { - Identifier = MN_LANGUAGE_SELECTION ; + Identifier = MN_SET_LANGUAGE_SELECTION ; SubMenu = Menu { }; @@ -77,7 +77,7 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_LANGUAGE_PARAGRAPH ; + Identifier = MN_SET_LANGUAGE_PARAGRAPH ; SubMenu = Menu { }; @@ -86,7 +86,7 @@ Menu MN_SPELL_POPUP /* MenuItem { - Identifier = MN_LANGUAGE_ALL_TEXT ; + Identifier = MN_SET_LANGUAGE_ALL_TEXT ; SubMenu = Menu { }; @@ -115,6 +115,11 @@ String STR_LANGSTATUS_NONE { Text [ en-US ] = "None (Do not check spelling)" ; }; +String STR_RESET_TO_DEFAULT_LANGUAGE +{ + Text [ en-US ] = "Reset to Default Language" ; + Text [ x-comment ] = " "; +}; String STR_LANGSTATUS_MORE { Text [ en-US ] = "More..." ; diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 52c4d10c3f02..e795c123d3a2 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -27,13 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> -#include <tools/shl.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> + +#include <tools/shl.hxx> +#include <i18npool/mslangid.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> @@ -117,8 +121,8 @@ #include <docsh.hxx> #include <svl/undo.hxx> -#include "swabstdlg.hxx" //CHINA001 -#include "chrdlg.hrc" //CHINA001 +#include "swabstdlg.hxx" +#include "chrdlg.hrc" #include "misc.hrc" #include <app.hrc> @@ -1138,7 +1142,17 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq) bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh); break; } - case FN_THESAURUS_DLG: + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + break; + } + case SID_THESAURUS: { pOLV->StartThesaurus(); break; @@ -1246,8 +1260,25 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) SwLangHelper::GetLanguageStatus(pOLV,rSet); break; } + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + break; + } + // disable "Thesaurus" if the language is not supported - case FN_THESAURUS_DLG: + case SID_THESAURUS: { const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, @@ -1257,7 +1288,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) - rSet.DisableItem( FN_THESAURUS_DLG ); + rSet.DisableItem( SID_THESAURUS ); } break; case SID_HANGUL_HANJA_CONVERSION: @@ -1295,6 +1326,15 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 94d49720a50c..c95ad7e64c1c 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -27,8 +27,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> + +#include <comphelper/processfactory.hxx> +#include <i18npool/mslangid.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/request.hxx> #include <tools/shl.hxx> #include <svx/svdview.hxx> #include <editeng/spltitem.hxx> @@ -37,9 +43,7 @@ #include <editeng/widwitem.hxx> #include <editeng/kernitem.hxx> #include <editeng/escpitem.hxx> -#ifndef _SVX_PARAITEM_HXX //autogen #include <editeng/lspcitem.hxx> -#endif #include <editeng/adjitem.hxx> #include <editeng/crsditem.hxx> #include <editeng/shdditem.hxx> @@ -49,9 +53,7 @@ #include <editeng/fhgtitem.hxx> #include <editeng/colritem.hxx> #include <editeng/wghtitem.hxx> -#ifndef _SVX_CNTRITEM_HXX //autogen #include <editeng/cntritem.hxx> -#endif #include <editeng/postitem.hxx> #include <editeng/frmdiritem.hxx> #include <svx/svdoutl.hxx> @@ -59,6 +61,8 @@ #include <svl/whiter.hxx> #include <svl/cjkoptions.hxx> #include <svl/ctloptions.hxx> +#include <svtools/langtab.hxx> +#include <svl/languageoptions.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> @@ -67,48 +71,66 @@ #include <editeng/editstat.hxx> #include <svx/hlnkitem.hxx> #include <svx/htmlmode.hxx> +#include <svl/languageoptions.hxx> +#include <svl/slstitm.hxx> #include <editeng/langitem.hxx> +#include <svtools/langtab.hxx> #include <editeng/unolingu.hxx> #include <editeng/scripttypeitem.hxx> #include <editeng/writingmodeitem.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/editeng.hxx> +#include <editeng/editdata.hxx> +#include <editeng/outliner.hxx> +#include <vcl/window.hxx> +#include <editeng/editview.hxx> +#include <vcl/outdev.hxx> +#include <editeng/hyznitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/orphitem.hxx> +#include <editeng/outliner.hxx> +#include <editeng/postitem.hxx> +#include <editeng/scripttypeitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/spltitem.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdview.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/unolingu.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/widwitem.hxx> +#include <editeng/writingmodeitem.hxx> +#include <tools/shl.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/outdev.hxx> +#include <vcl/window.hxx> + +#include <cmdid.h> #include <doc.hxx> -#include <wview.hxx> -#include <viewopt.hxx> -#include <wrtsh.hxx> -#include <uitool.hxx> +#include <docstat.hxx> +#include <drwtxtsh.hxx> +#include <edtwin.hxx> +#include <globals.hrc> +#include <hintids.hxx> +#include <initui.hxx> // fuer SpellPointer +#include <langhelper.hxx> #include <pardlg.hxx> +#include <shells.hrc> +#include <string.h> #include <swdtflvr.hxx> -#include <drwtxtsh.hxx> #include <swmodule.hxx> -#include <initui.hxx> // fuer SpellPointer -#include <edtwin.hxx> #include <swwait.hxx> -#include <docstat.hxx> - -#include <comphelper/processfactory.hxx> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <uitool.hxx> +#include <viewopt.hxx> +#include <wrtsh.hxx> +#include <wview.hxx> -#include <cmdid.h> -#include <globals.hrc> -#include <shells.hrc> #include "swabstdlg.hxx" #include "chrdlg.hrc" #include "misc.hrc" -//modified on Jul. 30th -#include <svl/languageoptions.hxx> -#include <editeng/langitem.hxx> -#include <svtools/langtab.hxx> -#include <svl/slstitm.hxx> -#include <string.h> - -#include <editeng/eeitem.hxx> -#include <editeng/editeng.hxx> -#include <editeng/editdata.hxx> -#include <editeng/outliner.hxx> -#include <vcl/window.hxx> -#include <editeng/editview.hxx> -#include <vcl/outdev.hxx> #include <langhelper.hxx> @@ -148,6 +170,18 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh); break; } + + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + break; + } + case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -569,7 +603,27 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);; break; } - case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST; + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + + //! avoid puting the same item as SfxBoolItem at the end of this function + nSlotId = 0; + break; + } + + case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST; @@ -620,19 +674,17 @@ ASK_ESCAPE: } break; - case FN_THESAURUS_DLG: + case SID_THESAURUS: { // disable "Thesaurus" if the language is not supported const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) ); - LanguageType nLang = ((const SvxLanguageItem &) - rItem).GetLanguage(); - // + LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - if (!xThes.is() || nLang == LANGUAGE_NONE || - !xThes->hasLocale( SvxCreateLocale( nLang ) )) - rSet.DisableItem( FN_THESAURUS_DLG ); + if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) + rSet.DisableItem( SID_THESAURUS ); nSlotId = 0; } break; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 4b8e2c65c5fc..78a9b05ce70b 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -52,6 +52,7 @@ #include <editeng/editstat.hxx> #include <svx/svdoutl.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -392,7 +393,7 @@ void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq) { switch(rReq.GetSlot()) { - case FN_THESAURUS_DLG: + case SID_THESAURUS: pOLV->StartThesaurus(); break; @@ -717,6 +718,15 @@ void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq ) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx index 3a0fe1421a0c..37d5e1ed5d69 100755..100644 --- a/sw/source/ui/shells/langhelper.cxx +++ b/sw/source/ui/shells/langhelper.cxx @@ -66,7 +66,8 @@ using namespace ::com::sun::star; namespace SwLangHelper { - USHORT GetLanguageStatus(OutlinerView* pOLV,SfxItemSet& rSet) + + USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ) { ESelection aSelection = pOLV->GetSelection(); EditView& rEditView=pOLV->GetEditView(); @@ -110,7 +111,7 @@ namespace SwLangHelper return 0; } - bool SetLanguageStatus(OutlinerView* pOLV,SfxRequest &rReq,SwView &rView,SwWrtShell &rSh) + bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh ) { bool bRestoreSelection = false; SfxItemSet aEditAttr(pOLV->GetAttribs()); @@ -130,126 +131,132 @@ namespace SwLangHelper //!! SwTextShell got destroyed meanwhile.) SfxViewFrame *pViewFrame = rView.GetViewFrame(); - if (aNewLangTxt.EqualsAscii( "*" )) + if (aNewLangTxt.EqualsAscii( "*" )) + { + // open the dialog "Tools/Options/Language Settings - Language" + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if (pFact) { - // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS ); - pDlg->Execute(); - delete pDlg; - } + VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS ); + pDlg->Execute(); + delete pDlg; } - else + } + else + { + // setting the new language... + if (aNewLangTxt.Len() > 0) { - // setting the new language... - if (aNewLangTxt.Len() > 0) + const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); + const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); + const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); + const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); + const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); + + xub_StrLen nPos = 0; + bool bForSelection = true; + bool bForParagraph = false; + if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) { - const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); - const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); - const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); - const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); - - xub_StrLen nPos = 0; - bool bForSelection = true; - bool bForParagraph = false; - if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) - { - // ... for the current selection - aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); - bForSelection = true; - } - else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) - { - // ... for the current paragraph language - aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); - bForSelection = true; - bForParagraph = true; - } - else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) - { - // ... as default document language - aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); - bForSelection = false; - } + // ... for the current selection + aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); + bForSelection = true; + } + else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) + { + // ... for the current paragraph language + aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); + bForSelection = true; + bForParagraph = true; + } + else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) + { + // ... as default document language + aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); + bForSelection = false; + } - if (bForParagraph) - { - bRestoreSelection = true; - SwLangHelper::SelectPara( rEditView, aSelection ); - aSelection = pOLV->GetSelection(); - } - if (!bForSelection) // document language to be changed... - { - rSh.StartAction(); - rSh.LockView( TRUE ); - rSh.Push(); + if (bForParagraph) + { + bRestoreSelection = true; + SwLangHelper::SelectPara( rEditView, aSelection ); + aSelection = pOLV->GetSelection(); + } + if (!bForSelection) // document language to be changed... + { + rSh.StartAction(); + rSh.LockView( TRUE ); + rSh.Push(); - // prepare to apply new language to all text in document - rSh.SelAll(); - rSh.ExtendedSelectAll(); - } + // prepare to apply new language to all text in document + rSh.SelAll(); + rSh.ExtendedSelectAll(); + } + + if (aNewLangTxt == aStrNone) + SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr ); + else if (aNewLangTxt == aStrResetLangs) + SwLangHelper::ResetLanguages( rSh, pOLV, aSelection, bForSelection ); + else + SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangTxt, bForSelection, aEditAttr ); - if (aNewLangTxt != aStrNone) - SwLangHelper::SetLanguage( rSh, pEditEngine, aSelection, aNewLangTxt, bForSelection, aEditAttr ); + // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks + // when setting a new language attribute + if (bForSelection) + { + const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); + ULONG nCntrl = pEditEngine->GetControlWord(); + // turn off + if (!pVOpt->IsOnlineSpell()) + nCntrl &= ~EE_CNTRL_ONLINESPELLING; else - SwLangHelper::SetLanguage_None( rSh, pEditEngine, aSelection, bForSelection, aEditAttr ); + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); - // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks - // when setting a new language attribute - if (bForSelection) - { - const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); - ULONG nCntrl = pEditEngine->GetControlWord(); - // turn off - if (!pVOpt->IsOnlineSpell()) - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - else - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - //turn back on - if (pVOpt->IsOnlineSpell()) - nCntrl |= EE_CNTRL_ONLINESPELLING; - else - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - pEditEngine->CompleteOnlineSpelling(); - rEditView.Invalidate(); - } + //turn back on + if (pVOpt->IsOnlineSpell()) + nCntrl |= EE_CNTRL_ONLINESPELLING; + else + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); - if (!bForSelection) - { - // need to release view and restore selection... - rSh.Pop( FALSE ); - rSh.LockView( FALSE ); - rSh.EndAction(); - } + pEditEngine->CompleteOnlineSpelling(); + rEditView.Invalidate(); + } + + if (!bForSelection) + { + // need to release view and restore selection... + rSh.Pop( FALSE ); + rSh.LockView( FALSE ); + rSh.EndAction(); } } + } - // invalidate slot to get the new language displayed - pViewFrame->GetBindings().Invalidate( rReq.GetSlot() ); + // invalidate slot to get the new language displayed + pViewFrame->GetBindings().Invalidate( rReq.GetSlot() ); - rReq.Done(); - return bRestoreSelection; + rReq.Done(); + return bRestoreSelection; } - void SetLanguage(SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet) + void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ) { - SetLanguage(rWrtSh,0,ESelection(),rLangText,bIsForSelection,rCoreSet); + SetLanguage( rWrtSh, 0 , ESelection(), rLangText, bIsForSelection, rCoreSet ); } - void SetLanguage(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet) + void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ) { const LanguageType nLang = SvtLanguageTable().GetType( rLangText ); if (nLang != LANGUAGE_DONTKNOW) { USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ); + EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL; + DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" ); + //get ScriptType USHORT nLangWhichId = 0; bool bIsSingleScriptType = true; @@ -264,6 +271,9 @@ namespace SwLangHelper } if (bIsSingleScriptType) { + // change language for selection or paragraph + // (for paragraph is handled by previosuly having set the selection to the + // whole paragraph) if (bIsForSelection) { // apply language to current selection @@ -279,7 +289,7 @@ namespace SwLangHelper rWrtSh.SetAttr( rCoreSet ); } } - else // change document language + else // change language for all text { // set document default language switch (nLangWhichId) @@ -300,12 +310,12 @@ namespace SwLangHelper } } - void SetLanguage_None(SwWrtShell &rWrtSh,bool bIsForSelection, SfxItemSet &rCoreSet ) + void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ) { - SetLanguage_None(rWrtSh,0,ESelection(),bIsForSelection,rCoreSet); + SetLanguage_None( rWrtSh,0,ESelection(),bIsForSelection,rCoreSet ); } - void SetLanguage_None(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ) + void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ) { // EditEngine IDs const USHORT aLangWhichId_EE[3] = @@ -325,7 +335,12 @@ namespace SwLangHelper if (bIsForSelection) { - // apply language to current selection + // change language for selection or paragraph + // (for paragraph is handled by previosuly having set the selection to the + // whole paragraph) + + EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL; + DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" ); if (pEditEngine) { for (sal_uInt16 i = 0; i < 3; ++i) @@ -340,7 +355,7 @@ namespace SwLangHelper rWrtSh.SetAttr( rCoreSet ); } } - else // change document language + else // change language for all text { SvUShortsSort aAttribs; for (sal_uInt16 i = 0; i < 3; ++i) @@ -355,6 +370,39 @@ namespace SwLangHelper } } + void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection ) + { + ResetLanguages( rWrtSh, 0 , ESelection(), bIsForSelection ); + } + + void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection ) + { + (void) bIsForSelection; + (void) aSelection; + + // reset language for current selection. + // The selection should already have been expanded to the whole paragraph or + // to all text in the document if those are the ranges where to reset + // the language attributes + + if (pOLV) + { + EditView &rEditView = pOLV->GetEditView(); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE ); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK ); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL ); + } + else + { + SvUShortsSort aAttribs; + aAttribs.Insert( RES_CHRATR_LANGUAGE ); + aAttribs.Insert( RES_CHRATR_CJK_LANGUAGE ); + aAttribs.Insert( RES_CHRATR_CTL_LANGUAGE ); + rWrtSh.ResetAttr( &aAttribs ); + } + } + + /// @returns : the language for the selected text that is set for the /// specified attribute (script type). /// If there are more than one languages used LANGUAGE_DONTKNOW will be returned. @@ -450,7 +498,7 @@ namespace SwLangHelper /// 'In use' means the language(s) matching the script type(s) of the /// selected text. Or in other words, the language a spell checker would use. /// If there is more than one language LANGUAGE_DONTKNOW will be returned. - LanguageType GetCurrentLanguage(SfxItemSet aSet,USHORT nScriptType ) + LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType ) { //set language attribute to use according to the script type USHORT nLangWhichId = 0; @@ -517,7 +565,7 @@ namespace SwLangHelper return aText; } - String GetTextForLanguageGuessing(EditEngine* rEditEngine, ESelection aDocSelection ) + String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection ) { // string for guessing language String aText; diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index c2308b9def0a..0de14dc3dacb 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -62,7 +62,8 @@ #include <svx/htmlmode.hxx> #include <svx/pfiledlg.hxx> #include <svtools/htmlcfg.hxx> -#include <com/sun/star/i18n/TransliterationModules.hdl> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <sot/clsids.hxx> #include <editeng/acorrcfg.hxx> @@ -1027,6 +1028,15 @@ void SwTextShell::ExecTransliteration( SfxRequest & rReq ) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index b7aa72acfb2c..e7d7ef613f2b 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -27,7 +27,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + +#include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> + #include <comphelper/processfactory.hxx> #include <svx/dialogs.hrc> #include <hintids.hxx> @@ -338,6 +341,7 @@ void SwTextShell::Execute(SfxRequest &rReq) const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); + const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); SfxItemSet aCoreSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, @@ -376,10 +380,12 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.SelAll(); rWrtSh.ExtendedSelectAll(); } - if (aNewLangTxt != aStrNone) - SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); - else + if (aNewLangTxt == aStrNone) SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet ); + else if (aNewLangTxt == aStrResetLangs) + SwLangHelper::ResetLanguages( rWrtSh, bForSelection ); + else + SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); } // restore selection... @@ -396,6 +402,23 @@ void SwTextShell::Execute(SfxRequest &rReq) break; } + case SID_THES: + { + // replace word/selection with text from selected sub menu entry + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + { + SwView &rView2 = rWrtSh.GetView(); + const bool bSelection = rWrtSh.HasSelection(); + const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection ); + rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); + } + } + break; + case SID_CHARMAP: { InsertSymbol( rReq ); @@ -1375,6 +1398,38 @@ void SwTextShell::GetState( SfxItemSet &rSet ) } break; + case SID_THES: + { + // is there a valid selection to get text from? + String aText; + sal_Bool bValid = !rSh.HasSelection() || + (rSh.IsSelOnePara() && !rSh.IsMultiSelection()); + // prevent context menu from showing when cursor is not in or at the end of a word + // (GetCurWord will return the next word if there is none at the current position...) + const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD; + bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType ); + if (bValid && bWord) + aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord(); + + LanguageType nLang = rSh.GetCurLang(); + lang::Locale aLocale = SvxCreateLocale( nLang ); + String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); + + // set word and locale to look up as status value + String aStatusVal( aText ); + aStatusVal.AppendAscii( "#" ); + aStatusVal += aLangText; + + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + if (aText.Len() == 0 || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + } + break; + case FN_NUMBER_NEWSTART : if(!rSh.GetCurNumRule()) rSet.DisableItem(nWhich); diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src index 7c47fe6ef208..9cf4f910f183 100644 --- a/sw/source/ui/uiview/view.src +++ b/sw/source/ui/uiview/view.src @@ -299,8 +299,8 @@ ToolBox RID_TOOLS_TOOLBOX }; ToolBoxItem { - Identifier = FN_THESAURUS_DLG; - HelpID = FN_THESAURUS_DLG; + Identifier = SID_THESAURUS; + HelpID = SID_THESAURUS; Hide = TRUE; }; ToolBoxItem diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 04414b5d83db..b3f73f7c38e4 100644..100755 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -120,7 +120,7 @@ void SwView::ExecLingu(SfxRequest &rReq) { switch(rReq.GetSlot()) { - case FN_THESAURUS_DLG: + case SID_THESAURUS: StartThesaurus(); rReq.Ignore(); break; @@ -252,64 +252,31 @@ void SwView::StartTextConversion( // do not do text conversion if it is active elsewhere if (GetWrtShell().HasConvIter()) { -// MessBox( 0, WB_OK, String( SW_RES( STR_SPELL_TITLE ) ), -// String( SW_RES( STR_MULT_INTERACT_SPELL_WARN ) ) ).Execute(); return; } -/* - SfxErrorContext aContext( ERRCTX_SVX_LINGU_SPELLING, aEmptyStr, pEditWin, - RID_SVXERRCTX, DIALOG_MGR() ); - Reference< XSpellChecker1 > xSpell = ::GetSpellChecker(); - if(!xSpell.is()) - { // keine Arme keine Kekse - ErrorHandler::HandleError( ERRCODE_SVX_LINGU_LINGUNOTEXISTS ); - return; - } -*/ SpellKontext(sal_True); - SwViewOption* pVOpt = (SwViewOption*)pWrtShell->GetViewOptions(); - sal_Bool bOldIdle = pVOpt->IsIdle(); + const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); + const sal_Bool bOldIdle = pVOpt->IsIdle(); pVOpt->SetIdle( sal_False ); sal_Bool bOldIns = pWrtShell->IsInsMode(); pWrtShell->SetInsMode( sal_True ); + sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() || + pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); - { - sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() || - pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); - -// sal_Bool bIsSpellSpecial = sal_True; - - sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc(); - sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); + sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc(); + sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); -/* - if( bOther && !bIsSpellSpecial ) - // kein Sonderbereich eingeschaltet - { - // Ich will auch in Sonderbereichen trennen - QueryBox aBox( &GetEditWin(), SW_RES( DLG_SPECIAL_FORCED ) ); - if( aBox.Execute() == RET_YES && xProp.is()) - { - sal_Bool bTrue = sal_True; - Any aTmp(&bTrue, ::getBooleanCppuType()); - xProp->setPropertyValue( C2U(UPN_IS_SPELL_SPECIAL), aTmp ); - } - else - return; // Nein Es wird nicht gespellt - } -*/ - { - const uno::Reference< lang::XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, - nOptions, bIsInteractive, - bStart, bOther, bSelection ); - aWrap.Convert(); - } + { + const uno::Reference< lang::XMultiServiceFactory > xMgr( + comphelper::getProcessServiceFactory() ); + SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, + nOptions, bIsInteractive, + bStart, bOther, bSelection ); + aWrap.Convert(); } pWrtShell->SetInsMode( bOldIns ); @@ -557,16 +524,77 @@ void SwView::HyphenateDocument() } /*-------------------------------------------------------------------- + --------------------------------------------------------------------*/ + +bool SwView::IsValidSelectionForThesaurus() const +{ + // must not be a multi-selection, and if it is a selection it needs + // to be within a single paragraph + + const bool bMultiSel = pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); + const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); + return !bMultiSel && (!bSelection || pWrtShell->IsSelOnePara() ); +} + + +String SwView::GetThesaurusLookUpText( bool bSelection ) const +{ + return bSelection ? pWrtShell->GetSelTxt() : pWrtShell->GetCurWord(); +} + + +void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bSelection ) +{ + sal_Bool bOldIns = pWrtShell->IsInsMode(); + pWrtShell->SetInsMode( sal_True ); + + pWrtShell->StartAllAction(); + pWrtShell->StartUndo(UNDO_DELETE); + + if( !bSelection ) + { + if(pWrtShell->IsEndWrd()) + pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE ); + + pWrtShell->SelWrd(); + + // make sure the selection build later from the + // data below does not include footnotes and other + // "in word" character to the left and right in order + // to preserve those. Therefore count those "in words" + // in order to modify the selection accordingly. + const sal_Unicode* pChar = rLookUpText.GetBuffer(); + xub_StrLen nLeft = 0; + while (pChar && *pChar++ == CH_TXTATR_INWORD) + ++nLeft; + pChar = rLookUpText.Len() ? rLookUpText.GetBuffer() + rLookUpText.Len() - 1 : 0; + xub_StrLen nRight = 0; + while (pChar && *pChar-- == CH_TXTATR_INWORD) + ++nRight; + + // adjust existing selection + SwPaM *pCrsr = pWrtShell->GetCrsr(); + pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight; + pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft; + } + + pWrtShell->Insert( rSynonmText ); + + pWrtShell->EndUndo(UNDO_DELETE); + pWrtShell->EndAllAction(); + + pWrtShell->SetInsMode( bOldIns ); +} + + +/*-------------------------------------------------------------------- Beschreibung: Thesaurus starten --------------------------------------------------------------------*/ void SwView::StartThesaurus() { - if( pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext() ) - return; - sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); - if( bSelection && !pWrtShell->IsSelOnePara() ) + if (!IsValidSelectionForThesaurus()) return; SfxErrorContext aContext( ERRCTX_SVX_LINGU_THESAURUS, aEmptyStr, pEditWin, @@ -589,114 +617,32 @@ void SwView::StartThesaurus() sal_Bool bOldIdle = pVOpt->IsIdle(); pVOpt->SetIdle( sal_False ); -#ifdef TL_NEVER -//!!! hier mu� noch was getan werden... (Umsetzung der Funktionalitaet) - // ErrorLink setzen, alten merken - Link aOldLnk = pSpell->ChgErrorLink(LINK(this, SwView, SpellError)); -#endif - - // get initial LookUp text - String aTmp = bSelection ? - pWrtShell->GetSelTxt() : pWrtShell->GetCurWord(); + const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); + String aTmp = GetThesaurusLookUpText( bSelection ); Reference< XThesaurus > xThes( ::GetThesaurus() ); AbstractThesaurusDialog *pDlg = NULL; if ( !xThes.is() || !xThes->hasLocale( SvxCreateLocale( eLang ) ) ) - { SpellError( &eLang ); - } else { // create dialog { //Scope for SwWait-Object SwWait aWait( *GetDocShell(), sal_True ); + // load library with dialog only on demand ... SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - pDlg = pFact->CreateThesaurusDialog( &GetEditWin(), - xThes, aTmp, eLang ); - } - - { - // Hier wird der Thesaurus-Dialog im Applikationsfenster zentriert, - // und zwar oberhalb oder unterhalb der Cursorposition, je nachdem, - // wo mehr Platz ist. - - // Current Word: - SwRect aRect( pWrtShell->GetCharRect() ); - Point aTopPos = aRect.Pos(); - Point aBtmPos( aTopPos.X(), aRect.Bottom() ); - aTopPos = GetEditWin().LogicToPixel( aTopPos ); - aTopPos = GetEditWin().OutputToScreenPixel( aTopPos ); - aBtmPos = GetEditWin().LogicToPixel( aBtmPos ); - aBtmPos = GetEditWin().OutputToScreenPixel( aBtmPos ); - // ::frame::Desktop: - Rectangle aRct = GetEditWin().GetDesktopRectPixel(); - Point aWinTop( aRct.TopLeft() ); - Point aWinBtm( aRct.BottomRight() ); - if ( aTopPos.Y() - aWinTop.Y() > aWinBtm.Y() - aBtmPos.Y() ) - aWinBtm.Y() = aTopPos.Y(); - else - aWinTop.Y() = aBtmPos.Y(); - - Size aSz = pDlg->GetWindow()->GetSizePixel(); - if ( aWinBtm.Y() - aWinTop.Y() > aSz.Height() ) - { - aWinTop.X() = ( aWinTop.X() + aWinBtm.X() - aSz.Width() ) / 2; - aWinTop.Y() = ( aWinTop.Y() + aWinBtm.Y() - aSz.Height() ) / 2; - pDlg->GetWindow()->SetPosPixel( aWinTop ); - } + pDlg = pFact->CreateThesaurusDialog( &GetEditWin(), xThes, aTmp, eLang ); } if ( pDlg->Execute()== RET_OK ) - { - sal_Bool bOldIns = pWrtShell->IsInsMode(); - pWrtShell->SetInsMode( sal_True ); - - pWrtShell->StartAllAction(); - pWrtShell->StartUndo(UNDO_DELETE); - - if( !bSelection ) - { - if(pWrtShell->IsEndWrd()) - pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE ); - - pWrtShell->SelWrd(); - - // make sure the selection build later from the - // data below does not include footnotes and other - // "in word" character to the left and right in order - // to preserve those. Therefore count those "in words" - // in order to modify the selection accordingly. - const sal_Unicode* pChar = aTmp.GetBuffer(); - xub_StrLen nLeft = 0; - while (pChar && *pChar++ == CH_TXTATR_INWORD) - ++nLeft; - pChar = aTmp.Len() ? aTmp.GetBuffer() + aTmp.Len() - 1 : 0; - xub_StrLen nRight = 0; - while (pChar && *pChar-- == CH_TXTATR_INWORD) - ++nRight; - - // adjust existing selection - SwPaM *pCrsr = pWrtShell->GetCrsr(); - pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight; - pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft; - } - - pWrtShell->Insert( pDlg->GetWord() ); - - pWrtShell->EndUndo(UNDO_DELETE); - pWrtShell->EndAllAction(); - - pWrtShell->SetInsMode( bOldIns ); - - } + InsertThesaurusSynonym( pDlg->GetWord(), aTmp, bSelection ); } delete pDlg; pVOpt->SetIdle( bOldIdle ); - } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 23415b630252..f23b73f5dfad 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -303,7 +303,7 @@ void SwView::GetState(SfxItemSet &rSet) rSet.DisableItem( nWhich ); } break; - case FN_THESAURUS_DLG: + case SID_THESAURUS: { SwWrtShell &rSh = GetWrtShell(); if (2 <= rSh.GetCrsrCnt()) // multi selection? diff --git a/sw/source/ui/web/web.src b/sw/source/ui/web/web.src index 1aa7fc03b4c6..3d24d885dfa8 100644 --- a/sw/source/ui/web/web.src +++ b/sw/source/ui/web/web.src @@ -138,8 +138,8 @@ ToolBox RID_WEBTOOLS_TOOLBOX }; ToolBoxItem { - Identifier = FN_THESAURUS_DLG; - HelpID = FN_THESAURUS_DLG; + Identifier = SID_THESAURUS; + HelpID = SID_THESAURUS; Hide = TRUE; }; ToolBoxItem diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index c7cb89bf5e61..04f87e877aa5 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1387,7 +1387,20 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum) // <-- if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 ) { - const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; + // --> OD 2010-05-05 #i111172# + // If text node is already inside a list, assure that the indents + // are the same. Thus, adjust the indent change value by subtracting + // indents of to be applied list style. + SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; + if ( pTxtNode->GetNumRule() ) + { + const SwNumFmt aFmt( aNumRule.Get( 0 ) ); + if ( aFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent(); + } + } + // <-- aNumRule.ChangeIndent( nIndentChange ); } } diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index 7fb8db664b59..c3bef67c8c12 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -217,12 +217,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/sglobal/toolbar/findbar.xml b/sw/uiconfig/sglobal/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sw/uiconfig/sglobal/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml index 308406bfdffa..4b482e373d3f 100644 --- a/sw/uiconfig/sweb/menubar/menubar.xml +++ b/sw/uiconfig/sweb/menubar/menubar.xml @@ -165,12 +165,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:FormatColumns"/> diff --git a/sw/uiconfig/sweb/toolbar/findbar.xml b/sw/uiconfig/sweb/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sw/uiconfig/sweb/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml index 726b8905eadb..69b65cfd3e59 100644 --- a/sw/uiconfig/swform/menubar/menubar.xml +++ b/sw/uiconfig/swform/menubar/menubar.xml @@ -217,12 +217,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml index 726b8905eadb..69b65cfd3e59 100644 --- a/sw/uiconfig/swreport/menubar/menubar.xml +++ b/sw/uiconfig/swreport/menubar/menubar.xml @@ -217,12 +217,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 9634079ddeb2..fb10ca615b50 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -220,12 +220,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swriter/toolbar/findbar.xml b/sw/uiconfig/swriter/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sw/uiconfig/swriter/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml index 89ab81e790cf..ae0df22748fe 100644 --- a/sw/uiconfig/swxform/menubar/menubar.xml +++ b/sw/uiconfig/swxform/menubar/menubar.xml @@ -218,12 +218,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swxform/toolbar/findbar.xml b/sw/uiconfig/swxform/toolbar/findbar.xml new file mode 100644 index 000000000000..9ef9d8a1a78f --- /dev/null +++ b/sw/uiconfig/swxform/toolbar/findbar.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" /> + <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find & Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/> +</toolbar:toolbar> diff --git a/testautomation/global/required/includes/g_findbar.inc b/testautomation/global/required/includes/g_findbar.inc new file mode 100644 index 000000000000..38af3edd28aa --- /dev/null +++ b/testautomation/global/required/includes/g_findbar.inc @@ -0,0 +1,159 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : Joerg.Skottke@Sun.Com +'* +'* short description : Update test for the findbar +'* +'\*********************************************************************** + +testcase tUpdtFindBar() + + ' This test is incomplete. It needs to be integrated into all update tests + ' and it needs to be added to the toolbar management functions + + printlog( "Update test for the findbar" ) + + const TEST_STRING = "VCL Testtool" + + select case( gApplication ) + case "IMPRESS", "DRAW", "DATABASE" + kontext "FindBar" + if ( FindBar.exists() ) then + warnlog( "The FindBar should not be visible by default" ) + endif + end select + + hNewDocument() + + kontext "FindBar" + if ( FindBar.exists() ) then + + printlog( "FindBar has " & FindBar.getItemCount() & " items" ) + + printlog( "Insert text into search field" ) + FindText.setText( TEST_STRING ) + + printlog( "Click <Find next> (down arrow)" ) + DownSearch.click() + + kontext "Active" + if ( Active.exists( 1 ) ) then + printlog( "Expected message: " & Active.getText() + call DialogTest( Active ) + + kontext "Active" + Active.ok() + else + warnlog( "Messagebox missing <No matches found>" ) + endif + + printlog( "Click <Find last> (up arrow)" ) + kontext "FindBar" + UpSearch.click() + + kontext "Active" + if ( Active.exists( 1 ) ) then + printlog( "Expected message: " & Active.getText() + call DialogTest( Active ) + + kontext "Active" + Active.ok() + else + warnlog( "Messagebox missing <No matches found>" ) + endif + + warnlog( "#i111984 - exclude <SearchDialog> button from testing" ) + goto skip_SearchDialog + + printlog( "Search dialog button may not be visible by default" ) + kontext "FindBar" + if ( SearchDialog.exists() ) then + if ( SearchDialog.isVisible() ) then + SearchDialog.click() + warnlog( "Button <Search Dialog> is visible, it should be hidden by default" ) + else + printlog( "Button <Search Dialog> is hidden, good" ) + endif + else + warnlog( "<Search Dialog> button should not be visible" ) + endif + + printlog( "Add <Search Dialog> button to toolbar" ) + hToggleSearchDialog() + + kontext "FindBar" + SearchDialog.click() + + kontext "FindAndReplace" + if ( FindAndReplace.exists( 1 ) ) then + call DialogTest( FindAndReplace ) + + kontext "FindAndReplace" + if ( SearchFor.getSelText() = TEST_STRING ) then + printlog( "Test string has been inserted into <SearchFor> Listbox. Good." ) + else + warnlog( "Search string should have been copied from findbar to search dialog" ) + endif + FindAndReplace.close() + else + warnlog( "Dialog <Search And Replace> is missing" ) + endif + + printlog( "Remove <Search Dialog> button from toolbar" ) + hToggleSearchDialog() + + skip_SearchDialog: + + else + warnlog( "FindBar is not visible" ) + endif + + hCloseDocument() + +endcase + +'******************************************************************************* + +function hToggleSearchDialog() + + printlog( "Make button <Search Dialog> visible via context menu" ) + + const MENU_VISIBLE_BUTTONS = 1 + const MENU_SEARCH_AND_REPLACE = 4 + + kontext "FindBar" + FindBar.openContextMenu() + wait( 1000 ) + + hMenuSelectNr( MENU_VISIBLE_BUTTONS ) + wait( 1000 ) + + hMenuSelectNr( MENU_SEARCH_AND_REPLACE ) + wait( 1000 ) + +end function
\ No newline at end of file diff --git a/testautomation/global/required/includes/g_option.inc b/testautomation/global/required/includes/g_option.inc index 3ff884d6be57..4ea25785b68c 100644..100755 --- a/testautomation/global/required/includes/g_option.inc +++ b/testautomation/global/required/includes/g_option.inc @@ -502,21 +502,21 @@ testcase tToolsOptionsLanguageSettings Optionen.TypeKeys "<Down>", 6 WaitSlot() ' similar effect as a NOOP OptionenBearbeiten.Click - Kontext "SilbentrennungOptionen" - Call DialogTest ( SilbentrennungOptionen ) - SilbentrennungOptionen.Cancel + Kontext "HyphenationOptions" + Call DialogTest ( HyphenationOptions ) + HyphenationOptions.Cancel Kontext "TabLinguistik" Optionen.TypeKeys "<Down>" OptionenBearbeiten.Click - Kontext "SilbentrennungOptionen" - Call DialogTest ( SilbentrennungOptionen ) - SilbentrennungOptionen.Cancel + Kontext "HyphenationOptions" + Call DialogTest ( HyphenationOptions ) + HyphenationOptions.Cancel Kontext "TabLinguistik" Optionen.TypeKeys "<Down>" OptionenBearbeiten.Click - Kontext "SilbentrennungOptionen" - Call DialogTest ( SilbentrennungOptionen ) - SilbentrennungOptionen.Cancel + Kontext "HyphenationOptions" + Call DialogTest ( HyphenationOptions ) + HyphenationOptions.Cancel endif case 3,5 : try diff --git a/testautomation/global/sid/all.sid b/testautomation/global/sid/all.sid index 8639bfa0f0b6..5ee1c157235f 100755..100644 --- a/testautomation/global/sid/all.sid +++ b/testautomation/global/sid/all.sid @@ -479,14 +479,12 @@ FormatAusrichtung SID_ALIGN ' **** ' **** Alle ExtrasRechtschreibungAutomatisch SID_AUTOSPELL_CHECK -ExtrasSilbentrennung FN_HYPHENATE_OPT_DLG ExtrasAutoKorrektur SID_AUTO_CORRECT_DLG ExtrasMakro SID_BASICCHOOSER ExtrasAnpassen SID_CONFIG ExtrasOptionen SID_OPTIONS_TREEDIALOG ' **** Writer -ExtrasThesaurusWriter FN_THESAURUS_DLG ExtrasKapitelnumerierung FN_NUMBERING_OUTLINE_DLG ExtrasZeilennumerierung FN_LINE_NUMBERING_DLG ExtrasSeitennummer FN_CHANGE_PAGENUM @@ -505,7 +503,6 @@ ExtrasAktualisierenSeitenformatierung FN_REPAGINATE ExtrasSeitenformatierung FN_REPAGINATE ' **** Calc -ExtrasThesaurusCalc SID_THESAURUS ExtrasDetektivAlleSpurenEntfernen SID_DETECTIVE_DEL_ALL ExtrasDetektivFuellModus SID_DETECTIVE_FILLMODE ExtrasDetektivSpurZumFehler SID_DETECTIVE_ADD_ERR @@ -525,7 +522,6 @@ ExtrasAutoEingabe FID_AUTOCOMPLETE ' **** Draw / Impress ExtrasThesaurusDraw SID_THESAURUS -ExtrasSilbentrennungDraw SID_HYPHENATION ExtrasPipette SID_BMPMASK ExtrasDiawechsel .uno:SlideChangeWindow ExtrasAnimation SID_ANIMATION_OBJECTS diff --git a/testautomation/global/sid/e_all.sid b/testautomation/global/sid/e_all.sid index 2fde9b77b5a4..b9fa2d9c81e8 100644 --- a/testautomation/global/sid/e_all.sid +++ b/testautomation/global/sid/e_all.sid @@ -414,6 +414,9 @@ FormatStylesLoad SID_TEMPLATE_LOAD FormatStylist SID_STYLE_DESIGNER FormatControl SID_FM_CTL_PROPERTIES FormatForm SID_FM_PROPERTIES +FormatChangeCaseToSentence .uno:ChangeCaseToSentenceCase +FormatChangeCaseCapitalizeEveryWord .uno:ChangeCaseToTitleCase +FormatChangeCaseToggleCase .uno:ChangeCaseToToggleCase FormatChangeCaseUpper .uno:ChangeCaseToUpper FormatChangeCaseLower .uno:ChangeCaseToLower FormatChangeCaseHalfWidth .uno:ChangeCaseToHalfWidth @@ -734,13 +737,13 @@ ToolsUpdateAllIndexes FN_UPDATE_TOX ToolsBibliographyDatabase SID_COMP_BIBLIOGRAPHY ToolsWordCount FN_WORDCOUNT_DIALOG TableTableProperties .uno:TableDialog +ToolsLanguageHyphenation FN_HYPHENATE_OPT_DLG ' **** WriterWeb ToolsPageFormatting FN_REPAGINATE ' **** Calc ToolsSpellcheckAutoCheckCalc SID_AUTOSPELL_CHECK -ToolsLanguageThesaurusCalc .uno:Thesaurus ToolsLanguageHyphenateCalc .uno:Hyphenate ToolsDetectiveRemoveAllTraces SID_DETECTIVE_DEL_ALL ToolsDetectiveFillMode SID_DETECTIVE_FILLMODE @@ -766,6 +769,7 @@ ToolsGallery .uno:Gallery ToolsEyedropper SID_BMPMASK ToolsMediaPlayer .uno:AVMediaPlayer ToolsChineseTranslation .uno:ChineseConversion +ToolsLanguageHyphenationDraw SID_HYPHENATION ' **** Math ToolsSymbolsCatalog SID_SYMBOLS_CATALOGUE diff --git a/testautomation/global/win/bars.win b/testautomation/global/win/bars.win index dd65f825893d..525be7d897ca 100755 --- a/testautomation/global/win/bars.win +++ b/testautomation/global/win/bars.win @@ -356,6 +356,13 @@ ExtrusionLightingFloater .uno:ExtrusionLightingFloater ExtrusionSurfaceFloater .uno:ExtrusionSurfaceFloater Extrusion3DColor .uno:Extrusion3DColor '------------------------------------------------------------------------- +*FindBar .HelpId:findbar +'------------------------------------------------------------------------- +FindText .uno:FindText +DownSearch .uno:DownSearch +UpSearch .uno:UpSearch +SearchDialog .uno:SearchDialog +'------------------------------------------------------------------------- *Flowchart .HelpId:flowchartshapes '------------------------------------------------------------------------- Process .uno:FlowChartShapes.flowchart-process diff --git a/testautomation/global/win/dial_p_s.win b/testautomation/global/win/dial_p_s.win index 6f76fe17b2bd..accef3714a3b 100755 --- a/testautomation/global/win/dial_p_s.win +++ b/testautomation/global/win/dial_p_s.win @@ -231,16 +231,6 @@ FormatRTF sw:CheckBox:DLG_MAILMERGE:CB_FORMAT_RTF FormatStarWriter sw:CheckBox:DLG_MAILMERGE:CB_FORMAT_SW Datenbankfeldliste sw:ListBox:DLG_MAILMERGE:LB_COLUMN -*Silbentrennung HID_HYPHENATE svx:ModalDialog:RID_SVXDLG_HYPHENATE -Wort cui:Edit:RID_SVXDLG_HYPHENATE:ED_WORD -Vor cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_LEFT -Zurueck cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_RIGHT -Weiter cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_CONTINUE -Entfernen cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_DELETE - -*SilbentrennungOptionen HID_LNGDLG_NUM_PREBREAK -ZeichenVorUmbruch cui:NumericField:RID_SVXDLG_LNG_ED_NUM_PREBREAK:ED_PREBREAK - *Sonderzeichen SID_CHARMAP Schrift cui:ListBox:RID_SVXDLG_CHARMAP:LB_FONT SchriftListe HID_CHARMAP_CTL_SHOWSET @@ -341,9 +331,6 @@ Zusaetze sc:MoreButton:RID_SCDLG_SPEC_FILTER:BTN_MORE FilterkriterienMin sc:ImageButton:RID_SCDLG_SPEC_FILTER:RB_CRITERIA_AREA FilterergebnisMin sc:ImageButton:RID_SCDLG_SPEC_FILTER:RB_COPY_AREA -*SpracheAuswaehlen HID_THES_LANGUAGE -Auswahl cui:ListBox:RID_SVXDLG_THES_LANGUAGE:LB_THES_LANGUAGE - *StandardFilter SID_FILTER FeldName1 sc:ListBox:RID_SCDLG_FILTER:LB_FIELD1 Feldname2 sc:ListBox:RID_SCDLG_FILTER:LB_FIELD2 diff --git a/testautomation/global/win/dial_t_z.win b/testautomation/global/win/dial_t_z.win index 899254eb6519..1f317fd412da 100755 --- a/testautomation/global/win/dial_t_z.win +++ b/testautomation/global/win/dial_t_z.win @@ -125,14 +125,6 @@ Umrandung sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_BORDER Textmarken sw:ComboBox:DLG_INSERT_BOOKMARK:CB_BOOKMARK Loeschen sw:PushButton:DLG_INSERT_BOOKMARK:BT_DELETE -*Thesaurus SID_THESAURUS -Wort cui:ListBox:RID_SVXDLG_THESAURUS:LB_WORD -Ersetzen cui:Edit:RID_SVXDLG_THESAURUS:ED_REPL -Bedeutung cui:ListBox:RID_SVXDLG_THESAURUS:LB_MEAN -Synonym cui:ListBox:RID_SVXDLG_THESAURUS:LB_SYNON -Nachschlagen cui:PushButton:RID_SVXDLG_THESAURUS:BTN_LOOKUP -Sprache cui:PushButton:RID_SVXDLG_THESAURUS:BTN_LANGUAGE - *Ueberblenden SID_POLYGON_MORPHING Attributierung sd:CheckBox:DLG_MORPH:CBX_ATTRIBUTES GleicheOrientierung sd:CheckBox:DLG_MORPH:CBX_ORIENTATION diff --git a/testautomation/global/win/edia_d_h.win b/testautomation/global/win/edia_d_h.win index 0e2fd251d285..2829054eba2d 100755 --- a/testautomation/global/win/edia_d_h.win +++ b/testautomation/global/win/edia_d_h.win @@ -481,8 +481,20 @@ Suggestion4 cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_4 NewEntry cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_NEW DeleteEntry cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_DELETE +*Hyphenation HID_HYPHENATE svx:ModalDialog:RID_SVXDLG_HYPHENATE +Wort cui:Edit:RID_SVXDLG_HYPHENATE:ED_WORD +Vor cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_LEFT +Zurueck cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_RIGHT +Weiter cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_CONTINUE +Entfernen cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_DELETE +HyphenateAll cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_ALL + +*HyphenationOptions HID_LNGDLG_NUM_PREBREAK +ZeichenVorUmbruch cui:NumericField:RID_SVXDLG_LNG_ED_NUM_PREBREAK:ED_PREBREAK + *HTMLImportOptions sc:ModalDialog:RID_SCDLG_TEXT_IMPORT_OPTIONS Automatic sc:RadioButton:RID_SCDLG_TEXT_IMPORT_OPTIONS:RB_AUTOMATIC Custom sc:RadioButton:RID_SCDLG_TEXT_IMPORT_OPTIONS:RB_CUSTOM CustomLanguage sc:ListBox:RID_SCDLG_TEXT_IMPORT_OPTIONS:LB_CUSTOM_LANG DetectSpecialNumbers sc:CheckBox:RID_SCDLG_TEXT_IMPORT_OPTIONS:BTN_CONVERT_DATE + diff --git a/testautomation/global/win/edia_t_z.win b/testautomation/global/win/edia_t_z.win index 7db84bc17be9..670a872ac657 100755 --- a/testautomation/global/win/edia_t_z.win +++ b/testautomation/global/win/edia_t_z.win @@ -128,6 +128,13 @@ RecentFile HID_XML_FILTER_TEST_IMPORT_RECENT FixedRecentFile HID_XML_FILTER_TEST_IMPORT_RECENT_FILE CloseBtn HID_XML_FILTER_TEST_CLOSE +*Thesaurus SID_THESAURUS +CurrentWord cui:ComboBox:RID_SVXDLG_THESAURUS:CB_WORD +RecallCurrentWord cui:ImageButton:RID_SVXDLG_THESAURUS:BTN_LEFT +Alternatives HID_CT_THES_ALTERNATIVES +ReplaceWith cui:Edit:RID_SVXDLG_THESAURUS:ED_REPL +Language cui:MenuButton:RID_SVXDLG_THESAURUS:MB_LANGUAGE + *TextImport SC:MODALDIALOG:RID_SCDLG_ASCII CharacterSet SC:LISTBOX:RID_SCDLG_ASCII:LB_CHARSET Language sc:ListBox:RID_SCDLG_ASCII:LB_CUSTOMLANG diff --git a/testautomation/graphics/optional/g_tools.bas b/testautomation/graphics/optional/g_tools.bas index bb890f970722..272840602ac4 100755..100644 --- a/testautomation/graphics/optional/g_tools.bas +++ b/testautomation/graphics/optional/g_tools.bas @@ -43,6 +43,8 @@ sub main PrintLog "-------------------------" + gApplication + "-------------------" Call tiToolsThesaurus + Call tiToolsThesaurusWithoutText + Call tiToolsThesaurusContextMenu Call tiToolsHyphenation1 Call tiToolsHyphenation2 Call tToolsMacro @@ -50,6 +52,8 @@ sub main gApplication = "DRAW" PrintLog "-------------------------" + gApplication + "-------------------" Call tiToolsThesaurus + Call tiToolsThesaurusWithoutText + Call tiToolsThesaurusContextMenu Call tiToolsHyphenation1 Call tiToolsHyphenation2 Call tToolsMacro diff --git a/testautomation/graphics/optional/includes/global/g_tools.inc b/testautomation/graphics/optional/includes/global/g_tools.inc index b5cdd71e0416..2d802af5b40c 100644 --- a/testautomation/graphics/optional/includes/global/g_tools.inc +++ b/testautomation/graphics/optional/includes/global/g_tools.inc @@ -40,49 +40,55 @@ '------------------------------------------------------------------------------- testcase tiToolsThesaurus - Dim DasWort$ - Dim ZaehlerBedeutung - -'/// for normal text, the thesaurus is enabled, if the format->character->language of the word has a thesaurus///' -'///+ unfortunately in textboxes this doesn't work, you can give the word a langauge, but this is been ignored by///' -'///+ our thesaurus :-(((///' -'/// so especially for asian languages you have to set a default language in the options, to be able to use///' -'///+ the thesaurus there - fallback to englisch, because there is no ? thesaurus for cjk languages ??///' - - '/// First we make sure we test a language where Thesa - ' As long as OOo has no modules for that, disabled - if gOOO = True then - printlog "No spellchecking in OOo" - goto endsub - endif + Dim sWord as string + Dim sChangedWord as string + Dim sReplaceWord as string + Dim sAlternativeText as string + Dim sExt as string + Dim ZaehlerBedeutung + 'for normal text, the thesaurus is enabled, + 'if the format->character->language of the word has a thesaurus + 'unfortunately in textboxes this doesn't work, you can give the word a langauge, + 'but this is been ignored by our thesaurus + 'so especially for asian languages you have to set a default language in the options, + 'to be able to use the thesaurus there - fallback to englisch, + 'because there is no thesaurus for cjk languages + + 'As long as OOo has no modules for that, disabled + if gOOO = True then + printlog "No spellchecking in OOo" + goto endsub + endif + + 'First we make sure we test a language where Thesaurus select case iSprache - case 01 : DasWort$ = "Hello" - case 03 : DasWort$ = "Alo" + case 01 : sWord = "Hello" + case 03 : sWord = "Alo" case 07 : printlog "- No Thesaur for Russian available" goto endsub case 30 : Printlog "- No Thesaurus available !" goto endsub - case 31 : DasWort$ = "Guiten" - case 33 : DasWort$ = "Bonjour" - case 34 : DasWort$ = "Hola" + case 31 : sWord = "Guiten" + case 33 : sWord = "Bonjour" + case 34 : sWord = "Hola" case 35 : Printlog "- No Thesaurus available !" goto endsub case 36 : Printlog "- No Thesaurus available !" goto endsub case 37 : Printlog "- No Thesaurus available !" goto endsub - case 39 : DasWort$ = "Ciao" + case 39 : sWord = "Ciao" case 42 : Printlog "- No Thesaurus available !" goto endsub - case 45 : DasWort$ = "Hej" - case 46 : DasWort$ = "Välkommen" + case 45 : sWord = "Hej" + case 46 : sWord = "Välkommen" case 47 : Printlog "- No Thesaurus available !" goto endsub case 48 : Printlog "- No Thesaurus in Polish!" goto endsub - case 49 : DasWort$ = "Hallo" - case 50 : DasWort$ = "Prosojnica" + case 49 : sWord = "Hallo" + case 50 : sWord = "Prosojnica" case 51 : Printlog "- No Thesaurus available !" goto endsub case 55 : Printlog "- No Thesaurus in Brazilian!" @@ -92,83 +98,237 @@ testcase tiToolsThesaurus case else : if bAsianLan then hSetSpellHypLanguage - DasWort$ = "Hello" + sWord = "Hello" else Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" - DasWort$ = "Hello" + sWord = "Hello" endif end select + + PrintLog "Thesaurus with 1 word: " + sWord + + if( Ucase(gApplication) = "DRAW" ) then + sExt = ".odg" + elseif( Ucase(gApplication) = "IMPRESS" ) then + sExt = ".odp" + endif + + Call hFileOpen (gTesttoolpath + "graphics\required\input\recht_" + iSprache + sExt) + Call sMakeReadOnlyDocumentEditable() + Call hTextrahmenErstellen (sWord,20,20,50,30) + sleep 1 + + printlog "select the word" + hTypeKeys "<Home><SHIFT END>" + + try + ExtrasThesaurusDraw + catch + warnlog "No Thesaurus available." + hCloseDocument() + goto endsub + endcatch + + Kontext "Thesaurus" + if Thesaurus.Exists(3) then + + if CurrentWord.GetSelText <> sWord Then + WarnLog "marked word should be:" + sWord + " but it is:" + CurrentWord.GetSelText + else + PrintLog "Marked word is correctly changed" + endif + + if Alternatives.GetItemCount = 0 Then + warnlog "There are no alternative for this word" + sleep 1 + else + printlog "select the first alternative" + Alternatives.Select 1 + + printlog "check if the selected alternative apprear in the ReplaceWith field." + + sAlternativeText = Alternatives.getSeltext(1,3) + 'remove the part in the () if there is any + if( Instr(sAlternativeText, "(") <> 0 ) then + sAlternativeText = left(sAlternativeText, Instr(sAlternativeText, "(") - 2 ) + endif + + if ( ReplaceWith.getText() <> sAlternativeText ) then + warnlog "the text is no transfered to the ReplaceWith field. " +_ + "ReplaceWith = " + ReplaceWith.getText() + ", Alternative = " + sAlternativeText + else + printlog "the text is transfered to the ReplaceWith field." + endif + + sReplaceWord = ReplaceWith.getText() + sleep 1 + endif + Thesaurus.OK - printlog " Thesaurus without any word in the document" - Call hNewDocument '/// New document ///' - try - ExtrasThesaurusDraw '/// try thesaurus in empty document ///' - Kontext "Thesaurus" - Thesaurus.Cancel - WarnLog " If no word is in the document, Thesaurus shouldn't be available" - catch - PrintLog " No Thesaurus available" - endcatch - - PrintLog " Thesaurus with 1 word: " + DasWort$ - - Call hTextrahmenErstellen (DasWort$,20,20,50,30) - sleep 1 - - hTypeKeys "<Home><SHIFT END>" - '------------------------ -ToolsOptions -Kontext "ExtrasOptionenDlg" -hToolsOptions("LANGUAGESETTINGS","Languages") -Westlich.Select 34 -Kontext "ExtrasOptionenDlg" -ExtrasOptionenDlg.OK -sleep 1 - '------------------------ - try - ExtrasThesaurusDraw '/// Thesaurus with only 1 word ///' - Kontext "Thesaurus" - if Thesaurus.Exists(3) then - if Wort.GetSelText <> DasWort$ Then WarnLog "marked word should be:" + DasWort$ + " but it is:" + Wort.GetSelText - if Wort.GetSelText = DasWort$ Then PrintLog " Marked word is correctly changed" '/// Control if word has changed ///' - ZaehlerBedeutung=Bedeutung.GetItemCount - if Bedeutung.GetItemCount = 0 Then - PrintLog " There are no suggestions for this word" - sleep 1 + if(Ucase(gApplication) = "DRAW") then + Kontext "Draw" + elseif(Ucase(gApplication) = "IMPRESS") then + Kontext "Impress" + else ' fallback + warnlog "gApplication is wrong" + goto endsub + endif + + hTypeKeys "<Home><SHIFT END>" + EditCopy + sChangedWord = getClipboard() + printlog "sChangedWord = " + sChangedWord + if(sChangedWord <> sReplaceWord) then + warnlog "the text was not replaced" else - if ZaehlerBedeutung=1 Then - Bedeutung.Select ZaehlerBedeutung - else - Bedeutung.Select (ZaehlerBedeutung - 1) - end if - sleep 1 - Synonym.Select 1 '/// Select synonym 1///' - sleep 1 - if Ersetzen.GetText=Synonym.GetSelText Then PrintLog " Meaning transfered into Replace edit field" - if Ersetzen.GetText<>Synonym.GetSelText Then WarnLog " Replacement should have been: '" + Bedeutung.GetSelText + "' but it is '" + Ersetzen.GetText+"'" - endif - Thesaurus.Cancel - else - warnlog " thesaurus didn't come up, that's bad :-(" - end if - catch - warnLog " No Thesaurus available ??! check if options western has smth selected !! !TL!" - endcatch - Call hCloseDocument '/// Close document ///' - -endcase 'tiToolsThesaurus + printlog "the text was successfull replaced" + endif + else + warnlog "thesaurus didn't come up." + end if + + Call hCloseDocument + +endcase +'------------------------------------------------------------------------------- +testcase tiToolsThesaurusWithoutText + + printlog "Thesaurus without any word in the document" + Call hNewDocument + try + ExtrasThesaurusDraw + catch + printlog "the Thesaurus is correctly not available" + call hCloseDocument + goto endsub + endcatch + + WarnLog "If no word is in the document, Thesaurus shouldn't be available" + Kontext "Thesaurus" + if Thesaurus.Exists then + Thesaurus.Cancel + endif + + Call hCloseDocument + + +endcase +'------------------------------------------------------------------------------- +testcase tiToolsThesaurusContextMenu + + Dim sWord as string + Dim sExt as string + Dim iItemCount as Integer + + 'for normal text, the thesaurus is enabled, + 'if the format->character->language of the word has a thesaurus + 'unfortunately in textboxes this doesn't work, you can give the word a langauge, + 'but this is been ignored by our thesaurus + 'so especially for asian languages you have to set a default language in the options, + 'to be able to use the thesaurus there - fallback to englisch, + 'because there is no thesaurus for cjk languages + + 'As long as OOo has no modules for that, disabled + if gOOO = True then + printlog "No spellchecking in OOo" + goto endsub + endif + + 'First we make sure we test a language where Thesaurus + select case iSprache + case 01 : sWord = "Hello" + case 03 : sWord = "Alo" + case 07 : printlog "- No Thesaur for Russian available" + goto endsub + case 30 : Printlog "- No Thesaurus available !" + goto endsub + case 31 : sWord = "Guiten" + case 33 : sWord = "Bonjour" + case 34 : sWord = "Hola" + case 35 : Printlog "- No Thesaurus available !" + goto endsub + case 36 : Printlog "- No Thesaurus available !" + goto endsub + case 37 : Printlog "- No Thesaurus available !" + goto endsub + case 39 : sWord = "Ciao" + case 42 : Printlog "- No Thesaurus available !" + goto endsub + case 45 : sWord = "Hej" + case 46 : sWord = "Välkommen" + case 47 : Printlog "- No Thesaurus available !" + goto endsub + case 48 : Printlog "- No Thesaurus in Polish!" + goto endsub + case 49 : sWord = "Hallo" + case 50 : sWord = "Prosojnica" + case 51 : Printlog "- No Thesaurus available !" + goto endsub + case 55 : Printlog "- No Thesaurus in Brazilian!" + goto endsub + case 90 : Printlog "- No Thesaurus available !" + goto endsub + + case else : if bAsianLan then + hSetSpellHypLanguage + sWord = "Hello" + else + Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" + sWord = "Hello" + endif + end select + + PrintLog "Thesaurus with 1 word: " + sWord + + if( Ucase(gApplication) = "DRAW" ) then + sExt = ".odg" + Kontext "DrawDocument" + elseif( Ucase(gApplication) = "IMPRESS" ) then + sExt = ".odp" + Kontext "ImpressDocument" + endif + + Call hFileOpen (gTesttoolpath + "graphics\required\input\recht_" + iSprache + sExt) + + Call hTextrahmenErstellen (sWord,20,20,50,30) + sleep 1 + + printlog "select the word" + hTypeKeys "<Home><SHIFT END>" + + hOpenContextMenu + + hMenuSelectNr(14) ' the synonyms + iItemCount = hMenuItemGetCount + printlog iItemCount + if(iItemCount <= 2 ) then ' none and Thesaurus item + warnlog "There should be a synonymus display for the word '" + sWord + "' but it isn't." + endif + + hMenuSelectNr(iItemCount) ' the last item + + Kontext "Thesaurus" + if Thesaurus.Exists(5) then + printlog "Thesaurus dialog appear from the context menu" + Thesaurus.Cancel + else + warnlog "the thesaurus dialog does not appear fro mthe context menu of a selected word" + endif + + call hCloseDocument +endcase '------------------------------------------------------------------------------- testcase tiToolsHyphenation1 printlog " - Hyphenation without any text" Call hNewDocument '/// New impress document ///' sleep 3 - ExtrasSilbentrennungDraw '/// Try Silbentrennung with empty document ///' - Kontext "Silbentrennung" - if Silbentrennung.Exists(1) = True Then + ToolsLanguageHyphenationDraw '/// Try with empty document ///' + Kontext "Hyphenation" + if Hyphenation.Exists(1) = True Then Warnlog " - Dialog ist da" - Silbentrennung.Cancel + Hyphenation.Cancel else Printlog " - Hyphenation activated" end if @@ -200,11 +360,11 @@ testcase tiToolsHyphenation1 endif end select hTypeKeys "<Home>" - ExtrasSilbentrennungDraw '/// Try Silbentrennung ///' - Kontext "Silbentrennung" - if Silbentrennung.Exists =True Then + ToolsLanguageHyphenationDraw '/// Try ///' + Kontext "Hyphenation" + if Hyphenation.Exists =True Then Warnlog "Dialog exists" - Silbentrennung.Cancel + Hyphenation.Cancel else Kontext "Active" if Active.Exists then Active.OK @@ -219,7 +379,8 @@ testcase tiToolsHyphenation2 dim iWaitIndex as integer dim sExt as string - Dim i : Dim DasWort : Dim DasWort2 : Dim DasWort3 : Dim DasWort4 : Dim DasWort5 : Dim DasWort6 : Dim DasWort7 + Dim i : Dim DasWort2 : Dim DasWort3 : Dim DasWort4 : Dim DasWort5 : Dim DasWort6 : Dim DasWort7 + Dim DasWort as string dim sDraw as string dim sFile as string PrintLog "- Tools/Hyphenation2" @@ -275,7 +436,7 @@ testcase tiToolsHyphenation2 EditCopy sDraw = GetClipboardText() EditSelectAll '/// Select whole text ///' - ExtrasSilbentrennungDraw '/// Run Hyphenation ///' + ToolsLanguageHyphenationDraw '/// Run Hyphenation ///' gMouseClick 50,50 hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" '/// Select part of text and compare it with original text at this place ///' sleep 3 diff --git a/testautomation/graphics/optional/includes/global/id_006.inc b/testautomation/graphics/optional/includes/global/id_006.inc index a32bbd962ad5..d959d1cf828f 100644 --- a/testautomation/graphics/optional/includes/global/id_006.inc +++ b/testautomation/graphics/optional/includes/global/id_006.inc @@ -146,9 +146,9 @@ endcase testcase tiToolsHyphenation Call hNewDocument - ExtrasSilbentrennungDraw + ToolsLanguageHyphenationDraw WaitSlot (2000) 'sleep 2 - ExtrasSilbentrennungDraw + ToolsLanguageHyphenationDraw Call hCloseDocument endcase diff --git a/testautomation/graphics/required/d_updt.bas b/testautomation/graphics/required/d_updt.bas index 9d56a2c87fed..d191f2adea1c 100755..100644 --- a/testautomation/graphics/required/d_updt.bas +++ b/testautomation/graphics/required/d_updt.bas @@ -63,7 +63,7 @@ sub main call id_004 Call D_005_ call id_005 - call id_006 + call id_Tools call d_007 call id_007 call id_008 diff --git a/testautomation/graphics/required/i_updt_1.bas b/testautomation/graphics/required/i_updt_1.bas index 1d9b28f2aea9..141b261e3ee9 100755..100644 --- a/testautomation/graphics/required/i_updt_1.bas +++ b/testautomation/graphics/required/i_updt_1.bas @@ -58,7 +58,7 @@ sub main Call im_004_ call id_004 call id_005 - call id_006 + call id_Tools Call hStatusOut end sub diff --git a/testautomation/graphics/required/includes/global/id_006.inc b/testautomation/graphics/required/includes/global/id_006.inc index 0a8359c1efef..8e16f5ef5593 100644 --- a/testautomation/graphics/required/includes/global/id_006.inc +++ b/testautomation/graphics/required/includes/global/id_006.inc @@ -42,7 +42,21 @@ ' #1 tiToolsOptions '\********************************************************************************** - +'------------------------------------------------------------------------------ +sub id_Tools + printLog "--------- id_006 ----------" + call tiToolsSpellchecking + call tiToolsSpellcheckingAutomatic + call tiToolsThesaurus + call tiToolsHyphenation + call tiToolsAutoCorrect + call tChineseTranslation + call tiToolsMacro + call tiToolsGallery + call tiToolsEyedropper + call tToolsOptionsTest ' global one +end sub +'------------------------------------------------------------------------------- testcase tiToolsSpellchecking if not gOOO then ' Spellcheck doesn't work in OOo builds. @@ -86,9 +100,7 @@ testcase tiToolsSpellchecking else goto endsub endif endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - +'------------------------------------------------------------------------------- testcase tiToolsSpellcheckingAutomatic '/// open application ///' Call hNewDocument @@ -102,84 +114,116 @@ testcase tiToolsSpellcheckingAutomatic '/// close application ///' Call hCloseDocument endcase +'------------------------------------------------------------------------------- +testcase tiToolsThesaurus -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Dim sWord as string + Dim sExt as string -testcase tiToolsThesaurus - qaerrorlog "#i93133#: Thesaurus not active in loaded bugdoc" - goto endsub - if not gOOO then ' Thesaurus doesn't work in OOo builds. + 'for normal text, the thesaurus is enabled, + 'if the format->character->language of the word has a thesaurus + 'unfortunately in textboxes this doesn't work, you can give the word a langauge, + 'but this is been ignored by our thesaurus + 'so especially for asian languages you have to set a default language in the options, + 'to be able to use the thesaurus there - fallback to englisch, + 'because there is no thesaurus for cjk languages - dim sFileName as String - - '/// call subroutine 'hSetSpellHypLanguage' for setting the default language in the options, to enable it for languages, which don't provide a dictionary (usually asian ones) ///' - call hSetSpellHypLanguage - '/// open application-specific document which contains an American-formatted textframe with text. And select the text ///' - if (gApplication = "IMPRESS") then - sFileName = (ConvertPath (gTesttoolPath + "graphics\required\input\engtext.odp")) - else - sFileName = (ConvertPath (gTesttoolPath + "graphics\required\input\engtext.odg")) - end if - if hFileExists ( sFileName ) = FALSE then - warnlog "The language-file was not found or accessible! The test ends." + 'As long as OOo has no modules for that, disabled + if gOOO = True then + printlog "No spellchecking in OOo" goto endsub - end if - Call hFileOpen (sFileName) - - sleep (2) - - hTypeKeys "<TAB><RETURN>" - hTypeKeys "<END><SHIFT HOME>" - - ' Call hTextrahmenErstellen ("SimpleTest" + "<Mod1 Shift left>", 10, 10, 30, 40) - try - '/// Tools->Thesaurus ///' - ExtrasThesaurusDraw - Kontext "Thesaurus" - Call DialogTest ( Thesaurus ) - '/// click button 'language' ///' - Sprache.Click - Kontext "SpracheAuswaehlen" - Call DialogTest ( SpracheAuswaehlen ) - '/// cancel dialog 'select language' ///' - SpracheAuswaehlen.cancel - Kontext "Thesaurus" - '/// click button 'search' ///' - Nachschlagen.Click - kontext - '/// if messagebox exist, say OK; (word not found) ///' - if Messagebox.exists (5) then - printlog "Messagebox: word not in thesaurus: '"+Messagebox.gettext+"'" - Messagebox.ok - end if - sleep 1 - Kontext "Thesaurus" - '/// cancel dialog 'Thesaurus' ///' - Thesaurus.Cancel - catch - warnlog "Thesaurus didn't work :-(" - endcatch - sleep 1 - '/// close application ///' - Call hCloseDocument - else goto endsub endif -endcase -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 'First we make sure we test a language where Thesaurus + select case iSprache + case 01 : sWord = "Hello" + case 03 : sWord = "Alo" + case 07 : printlog "- No Thesaur for Russian available" + goto endsub + case 30 : Printlog "- No Thesaurus available !" + goto endsub + case 31 : sWord = "Guiten" + case 33 : sWord = "Bonjour" + case 34 : sWord = "Hola" + case 35 : Printlog "- No Thesaurus available !" + goto endsub + case 36 : Printlog "- No Thesaurus available !" + goto endsub + case 37 : Printlog "- No Thesaurus available !" + goto endsub + case 39 : sWord = "Ciao" + case 42 : Printlog "- No Thesaurus available !" + goto endsub + case 45 : sWord = "Hej" + case 46 : sWord = "Välkommen" + case 47 : Printlog "- No Thesaurus available !" + goto endsub + case 48 : Printlog "- No Thesaurus in Polish!" + goto endsub + case 49 : sWord = "Hallo" + case 50 : sWord = "Prosojnica" + case 51 : Printlog "- No Thesaurus available !" + goto endsub + case 55 : Printlog "- No Thesaurus in Brazilian!" + goto endsub + case 90 : Printlog "- No Thesaurus available !" + goto endsub + + case else : if bAsianLan then + hSetSpellHypLanguage + sWord = "Hello" + else + Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" + sWord = "Hello" + endif + end select + + PrintLog "Thesaurus with 1 word: " + sWord + + if( Ucase(gApplication) = "DRAW" ) then + sExt = ".odg" + elseif( Ucase(gApplication) = "IMPRESS" ) then + sExt = ".odp" + endif + + Call hFileOpen (gTesttoolpath + "graphics\required\input\recht_" + iSprache + sExt) + Call sMakeReadOnlyDocumentEditable() + Call hTextrahmenErstellen (sWord,20,20,50,30) + sleep 1 + printlog "select the word" + hTypeKeys "<Home><SHIFT END>" + + try + ExtrasThesaurusDraw + catch + warnlog "No Thesaurus available." + hCloseDocument() + goto endsub + endcatch + + Kontext "Thesaurus" + if Thesaurus.Exists(3) then + Thesaurus.Cancel + else + warnlog "the thesaurus does not appear" + endif + Call hCloseDocument + +endcase +'------------------------------------------------------------------------------- testcase tiToolsHyphenation '/// open application ///' Call hNewDocument '/// Tools->Hyphenation ///' - ExtrasSilbentrennungDraw + ToolsLanguageHyphenationDraw WaitSlot (2000) 'sleep 2 '/// Tools->Hyphenation ///' - ExtrasSilbentrennungDraw + ToolsLanguageHyphenationDraw '/// close application ///' Call hCloseDocument endcase - +'------------------------------------------------------------------------------- testcase tiToolsAutoCorrect dim iLanguage as integer ' for resetting the language '/// open application ///' @@ -291,9 +335,7 @@ testcase tiToolsAutoCorrect '/// close application ///' Call hCloseDocument endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - +'------------------------------------------------------------------------------- testcase tChineseTranslation qaerrorlog( "#i89634# - Chinese Translation dialog does not close" ) @@ -365,9 +407,7 @@ testcase tChineseTranslation '/// Close application ///' Call hCloseDocument endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - +'------------------------------------------------------------------------------- testcase tiToolsMacro '/// open application ///' Call hNewDocument @@ -419,9 +459,7 @@ testcase tiToolsMacro '/// close application ///' Call hCloseDocument endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - +'------------------------------------------------------------------------------- testcase tiToolsGallery '/// open application ///' Call hNewDocument @@ -433,9 +471,7 @@ testcase tiToolsGallery '/// close application ///' Call hCloseDocument endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - +'------------------------------------------------------------------------------- testcase tiToolsEyedropper '/// open application ///' Call hNewDocument @@ -449,20 +485,4 @@ testcase tiToolsEyedropper '/// close application ///' Call hCloseDocument endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -testcase tiToolsOptions - '/// open application ///' - Call hNewDocument - '/// Tools->Options ///' - ToolsOptions - WaitSlot (2000) 'sleep 1 - kontext "OptionenDlg" - '/// close dialog 'Options' ///' - OptionenDlg.Close - '/// close application ///' - Call hCloseDocument -endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +'-------------------------------------------------------------------------------
\ No newline at end of file diff --git a/testautomation/graphics/required/input/recht_3.odp b/testautomation/graphics/required/input/recht_3.odp Binary files differindex 77001190ba1a..768fbad4b780 100755..100644 --- a/testautomation/graphics/required/input/recht_3.odp +++ b/testautomation/graphics/required/input/recht_3.odp diff --git a/testautomation/graphics/required/input/recht_31.odp b/testautomation/graphics/required/input/recht_31.odp Binary files differindex a8fd2717ba3f..23f5c77c141d 100755..100644 --- a/testautomation/graphics/required/input/recht_31.odp +++ b/testautomation/graphics/required/input/recht_31.odp diff --git a/testautomation/graphics/required/input/recht_33.odp b/testautomation/graphics/required/input/recht_33.odp Binary files differindex e98bb9a22dc7..c6acada2537e 100755..100644 --- a/testautomation/graphics/required/input/recht_33.odp +++ b/testautomation/graphics/required/input/recht_33.odp diff --git a/testautomation/graphics/required/input/recht_34.odp b/testautomation/graphics/required/input/recht_34.odp Binary files differindex fbfe0ae7ffae..2dcbd561f9e5 100755..100644 --- a/testautomation/graphics/required/input/recht_34.odp +++ b/testautomation/graphics/required/input/recht_34.odp diff --git a/testautomation/graphics/required/input/recht_36.odp b/testautomation/graphics/required/input/recht_36.odp Binary files differindex a1f80f1109db..45f7fd3a47cb 100755..100644 --- a/testautomation/graphics/required/input/recht_36.odp +++ b/testautomation/graphics/required/input/recht_36.odp diff --git a/testautomation/graphics/required/input/recht_39.odp b/testautomation/graphics/required/input/recht_39.odp Binary files differindex feda53696ecf..bf649b488030 100755..100644 --- a/testautomation/graphics/required/input/recht_39.odp +++ b/testautomation/graphics/required/input/recht_39.odp diff --git a/testautomation/graphics/required/input/recht_46.odp b/testautomation/graphics/required/input/recht_46.odp Binary files differindex d6ec036f014d..e9de83b58c8b 100755..100644 --- a/testautomation/graphics/required/input/recht_46.odp +++ b/testautomation/graphics/required/input/recht_46.odp diff --git a/testautomation/graphics/required/input/recht_48.odp b/testautomation/graphics/required/input/recht_48.odp Binary files differindex 4d905a8fe4d8..f836b0521f8b 100755..100644 --- a/testautomation/graphics/required/input/recht_48.odp +++ b/testautomation/graphics/required/input/recht_48.odp diff --git a/testautomation/graphics/required/input/recht_49.odp b/testautomation/graphics/required/input/recht_49.odp Binary files differindex 445c11940122..88c93c2856b4 100755..100644 --- a/testautomation/graphics/required/input/recht_49.odp +++ b/testautomation/graphics/required/input/recht_49.odp diff --git a/testautomation/graphics/required/input/recht_55.odp b/testautomation/graphics/required/input/recht_55.odp Binary files differindex 2d63df264710..6e78d94e8c49 100755..100644 --- a/testautomation/graphics/required/input/recht_55.odp +++ b/testautomation/graphics/required/input/recht_55.odp diff --git a/testautomation/graphics/tools/id_tools_2.inc b/testautomation/graphics/tools/id_tools_2.inc index e5cf1a068adf..681a5ec7161a 100644 --- a/testautomation/graphics/tools/id_tools_2.inc +++ b/testautomation/graphics/tools/id_tools_2.inc @@ -835,24 +835,6 @@ sub id_005 ' tiFormatLayer ' not in impress end sub -'------------------------------------------------------------------------------ -sub id_006 - - printLog Chr(13) + "--------- id_006 ----------" - - call tiToolsSpellchecking - call tiToolsSpellcheckingAutomatic - call tiToolsThesaurus - call tiToolsHyphenation - call tiToolsAutoCorrect - call tChineseTranslation - call tiToolsMacro - call tiToolsGallery - call tiToolsEyedropper - call tiToolsOptions ' get just called one time here... - Call tToolsOptionsTest ' global one -end sub - '------------------------------------------------------------------------------- sub id_007 diff --git a/testautomation/spreadsheet/required/includes/c_upd_toolsmenu.inc b/testautomation/spreadsheet/required/includes/c_upd_toolsmenu.inc index 12f52f48d2d4..434aae88f786 100644..100755 --- a/testautomation/spreadsheet/required/includes/c_upd_toolsmenu.inc +++ b/testautomation/spreadsheet/required/includes/c_upd_toolsmenu.inc @@ -189,14 +189,14 @@ testcase tToolsSpellcheck '/// Click on 'Edit' – button printlog " Click on 'Edit' – button" OptionenBearbeiten.Click - Kontext "SilbentrennungOptionen" - Call DialogTest ( SilbentrennungOptionen ) + Kontext "HyphenationOptions" + Call DialogTest ( HyphenationOptions ) '/// Decrease 'Minimal word length' printlog " Decrease 'Minimal word length'" ZeichenVorUmbruch.More '/// Close dialog with 'Cancel' printlog " Close dialog with 'Cancel'" - SilbentrennungOptionen.Cancel + HyphenationOptions.Cancel Kontext "TabLinguistik" '/// Close dialog with 'Cancel' printlog " Close dialog with 'Cancel'" @@ -391,21 +391,17 @@ endcase testcase tToolsLanguageThesaurus '///<u><b>Tools – Language – Chinese Translation</b></u> - '/// Load document from 'gTesttoolPath + "spreadsheet\required\input\english.ods"' printlog " Load document from 'gTesttoolPath + spreadsheet\required\input\english.ods" Call hFileOpen (Convertpath (gTesttoolPath + "spreadsheet\required\input\english.ods" )) - '/// If the file is not editable, click the edit button on standardbar printlog "If the file is not editable, click the edit button on standardbar" call sMakeReadOnlyDocumentEditable Kontext "DocumentCalc" - '/// Enter 'blabla' in a cell - printlog " Enter 'blabla' in a cell" + printlog " Enter 'test' in a cell" Call fCalcSelectRange ("B2") - DocumentCalc.TypeKeys "blabla<Return><Up>" - '/// Open 'Thesaurus' dialog by 'Tools – Language – Thesaurus + DocumentCalc.TypeKeys "test<Return><Up>" printlog " Open 'Thesaurus' dialog by 'Tools – Language – Thesaurus" try - ToolsLanguageThesaurusCalc + ToolsLanguageThesaurus catch warnlog "Thesaurus did not work" call hCloseDocument @@ -413,34 +409,20 @@ testcase tToolsLanguageThesaurus endcatch Kontext "Thesaurus" DialogTest ( Thesaurus ) - '/// Click on 'Search' button - printlog " Click on 'Search' button" - Nachschlagen.Click - '/// Close messagebox with 'OK' - printlog " Close messagebox with 'OK'" - Kontext - if Active.exists then - Active.OK + printlog " Check if the cellcontent test is correctly read" + if CurrentWord.GetSelText <> "test" then + warnlog "The cellcontent is not test but is " & CurrentWord.GetSelText end if - Kontext "Thesaurus" - '/// Click on 'Language' button - printlog " Click on 'Language' button" - Sprache.Click - Kontext "SpracheAuswaehlen" - DialogTest ( SpracheAuswaehlen ) - '/// Verify that the list has entries - printlog " Verify that the list has entries" - If Auswahl.GetItemCount < 1 then - warnlog "There are no languages available" + printlog " Check that there are alternatives available" + if Alternatives.GetItemCount < 1 then + warnlog "There are no alternatives available" + else Alternatives.Select (1) + if ReplaceWith.GetText = "" then + warnlog "The repacle with field is empty" + end if end if - '/// Close 'Select Language' dialog with 'Cancel' - printlog " Close 'Select Language' dialog with 'Cancel'" - SpracheAuswaehlen.Cancel - Kontext "Thesaurus" - '/// Close 'Thesaurus' with 'Cancel' printlog " Close 'Thesaurus' with 'Cancel'" Thesaurus.Cancel - '/// Close document printlog " Close document" call hCloseDocument diff --git a/testautomation/writer/optional/includes/fields/w_fields1.inc b/testautomation/writer/optional/includes/fields/w_fields1.inc index 9f2d872b3d89..0287fd2f1da1 100644..100755 --- a/testautomation/writer/optional/includes/fields/w_fields1.inc +++ b/testautomation/writer/optional/includes/fields/w_fields1.inc @@ -170,8 +170,6 @@ endcase '----------------------------------------------------------------- testcase tInsertFieldsPageNumber -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sPage1 , sPage2 as String @@ -216,8 +214,6 @@ endcase '----------------------------------------------------------------- testcase tInsertFieldsPageCount -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sPage1 , sPage2 as String @@ -273,8 +269,6 @@ endcase '----------------------------------------------------------------- testcase tInsertFieldsSubject -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sSubject as String sSubject = "This is a Subject" @@ -306,8 +300,6 @@ endcase '----------------------------------------------------------------- testcase tInsertFieldsTitle -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sTitle as String @@ -340,8 +332,6 @@ endcase '----------------------------------------------------------------- testcase tInsertFieldsAuthor -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sFirstName , sLastName as String Dim sFirstName1 , sLastName1 as String diff --git a/testautomation/writer/optional/includes/fields/w_fields2.inc b/testautomation/writer/optional/includes/fields/w_fields2.inc index 826d9ec769b9..0514ba5b020e 100644..100755 --- a/testautomation/writer/optional/includes/fields/w_fields2.inc +++ b/testautomation/writer/optional/includes/fields/w_fields2.inc @@ -451,8 +451,6 @@ endcase '----------------------------------------------------------------- testcase tDocumentPage -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sTestFile as String Dim sPage() as String @@ -867,35 +865,32 @@ endcase '----------------------------------------------------------------- testcase tDocumentStatistics -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub Dim sTestFile as String + Dim sOriginalFile as string Dim sStatistics() as String + Dim sType as string Dim i as Integer - sStatistics = Array( _ - "2" , _ - "2" , _ - "2" , _ - "12" , _ - "2" , _ - "2" , _ - "1" , _ - ) + sStatistics = Array( "2", "2", "3", "13", "2", "2", "1" ) - sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\statisticsTest.sxw") + sTestFile = Convertpath (gOfficepath + "user\work\statisticsTest.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\statisticsTest.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if hFileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if printlog "Insert/Fields/Other/Document / Statistics" '/// <b> Insert/Fields/Other/Document / Statistics </b> - Call hNewDocument - '/// Open test file statisticsTest.sxw which includes '/// 2 tables , 2 pictures , 22 paragraph , 1 object , '/// 2 words , 12 characters and 2 pages Call hFileOpen(sTestFile) - Call sMakeReadOnlyDocumentEditable Call wTypeKeys "<MOD1 Home><Down>" @@ -904,6 +899,7 @@ goto endsub '/// Check if the insertion is correct Call fInsertFieldsOther("TabDokumentFeldbefehle") Feldtyp.Select fGetType("Statistics") + sType = Auswahl.GetSelText for i = 0 to UBound(sStatistics) Kontext "TabDokumentFeldbefehle" Auswahl.Select i+1 @@ -916,7 +912,7 @@ goto endsub Sleep 1 EditCopy if GetClipboard <> sStatistics(i) then - Warnlog i &" - Should get " & sStatistics(i) & " but get " & GetClipboard + Warnlog "- " & sType & ": Should get " & sStatistics(i) & " but get " & GetClipboard end if Call wTypeKeys "<Delete>" next i @@ -930,35 +926,39 @@ endcase '----------------------------------------------------------------- testcase tDocumentTemplate -qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" -goto endsub - - Dim sTestFile as String - Dim sDirectory as String - Dim oDirectory as String - Dim sLanguage as String - Dim sFormat() as String - Dim sResult(6) as String - Dim i as Integer + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sDirectory as String + Dim oDirectory as String + Dim sLanguage as String + Dim sFormat() as String + Dim sResult(6) as String + Dim i as Integer sLanguage = fGetDirLanguage() - sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\diploma.ott") + sTestFile = Convertpath (gOfficepath + "user\work\diploma.ott") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\diploma.ott") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if hFileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if sResult(0) = fGetCateGory() sResult(1) = "diploma.ott" sResult(2) = "diploma" - sResult(3) = Convertpath (gTesttoolpath + "writer\optional\input\fields\") + sResult(3) = Convertpath (gOfficepath + "user\work") sResult(4) = sTestFile sResult(5) = fGetStyle() printlog "Insert/Fields/Other/Document / Template" '/// <b> Insert/Fields/Other/Document / Template </b> - - Call hNewDocument - + '/// Open test file diploma.ott Call hFileOpen(sTestFile) - Call sMakeReadOnlyDocumentEditable Call wTypeKeys "<MOD1 Home>" diff --git a/testautomation/writer/optional/includes/fields/w_fields4.inc b/testautomation/writer/optional/includes/fields/w_fields4.inc index 446d5b458f0f..20069da398c1 100644..100755 --- a/testautomation/writer/optional/includes/fields/w_fields4.inc +++ b/testautomation/writer/optional/includes/fields/w_fields4.inc @@ -261,9 +261,8 @@ endcase '----------------------------------------------------------------- testcase tDocInformationUserDefined - qaerrorlog "#i93906# - Testcase outcommented due to bug. 'Copied field-content not pastable outside Office'" - goto endsub - + QAErrorLog "#i112077#Tabpage 'Custom properties' has no declaration" + goto endsub Dim sTestFile as String Dim sOriginalFile as string Dim sVarResult() as String diff --git a/testautomation/writer/optional/includes/fields/w_fields5.inc b/testautomation/writer/optional/includes/fields/w_fields5.inc index 2f4e3b0b9ecb..6c8b5e7ca12a 100644..100755 --- a/testautomation/writer/optional/includes/fields/w_fields5.inc +++ b/testautomation/writer/optional/includes/fields/w_fields5.inc @@ -667,99 +667,101 @@ endcase '----------------------------------------------------------------- testcase tVariablesDDEFieldManual - qaerrorlog "#i93906# - tVariablesDDEFieldManual outcommented due to a problem with copying field-contents outside the office." + warnlog "#i112079#testcase must be reworked" goto endsub - Dim sDDEFile as String - Dim sContent as String - Dim sName as String - Dim sDDEStatement as String - Dim sSectionName as String + Dim sDDEFile as String + Dim sContent as String + Dim sName as String + Dim sDDEStatement as String + Dim sSectionName as String + + sDDEFile = Convertpath ( gOfficePath + "\user\work\dde_test.odt") + sContent = "DDE" + sName = "myTest" + sSectionName = "Section1" + sDDEStatement = "soffice " & sDDEFile & " " & sSectionName + + printlog "DDE field - manual" + '/// <b> DDE field - manual </b> + + if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) + + Call hNewDocument + + '/// Input something , insert a section , then save it and close the file + Call wTypeKeys sContent + Call wTypeKeys "<Shift Home>" + Call fInsertSection("TabBereiche") + Bereichsliste.Settext sSectionName + TabBereiche.OK + Sleep 1 + Call hFileSaveAsKill(sDDEFile) + Call hCloseDocument + + '/// Opan a new document + Call hNewDocument + '/// Insert/Fields/Other/Variables / Select "DDE Field" + '/// Set DDE name and DDE statement , select "DDE manual" + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 3 + Sleep 1 + NameText.SetText sName + Wert.SetText sDDEStatement + Formatliste.Select 1 + Einfuegen.Click + Sleep 2 + TabVariablen.Close + Sleep 2 - sDDEFile = Convertpath ( gNetzOfficePath + "dde_test.oxt") - sContent = "DDE" - sName = "myTest" - sSectionName = "Section1" - sDDEStatement = "soffice " & sDDEFile & " " & sSectionName - - printlog "DDE field - manual" - '/// <b> DDE field - manual </b> - - if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) - - Call hNewDocument - - '/// Input something , insert a section , then save it and close the file - Call wTypeKeys sContent - Call wTypeKeys "<Shift Home>" - Call fInsertSection("TabBereiche") - Bereichsliste.Settext sSectionName - TabBereiche.OK - Sleep 1 - Call hFileSaveAsKill(sDDEFile) - Call hCloseDocument - - '/// Opan a new document - Call hNewDocument - - '/// Insert/Fields/Other/Variables / Select "DDE Field" - '/// Set DDE name and DDE statement , select "DDE manual" - Call fInsertFieldsOther("TabVariablen") - Feldtyp.Select 3 - Sleep 1 - NameText.SetText sName - Wert.SetText sDDEStatement - Formatliste.Select 1 - Einfuegen.Click - Sleep 2 - TabVariablen.Close - Sleep 2 - - Call wTypeKeys "<MOD1 Home>" - Call wTypeKeys "<Shift End>" - if fGetFieldContent() <> sContent then - Warnlog "Should get " & sContent & " but get " & fGetFieldContent() - end if + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> sContent then + Warnlog "Should get " & sContent & " but get " & fGetFieldContent() + end if - '/// Open the test file which you just closed , add something , - '/// Save the file - Call hFileOpen(sDDEFile) + '/// Open the test file which you just closed , add something , + '/// Save the file + Call hFileOpen(sDDEFile) Call wTypeKeys "<MOD1 Home>" Call wTypeKeys "XYZ" FileSave - Call hCloseDocument - - '/// Check if the content is changed -- Should NOT - Sleep 2 - Call wTypeKeys "<F9>" - Call wTypeKeys "<MOD1 Home><Shift End>" - if fGetFieldContent() <> sContent then - Warnlog "Should get " & sContent & " but get " & fGetFieldContent() - end if - - '/// Edit/Fields , press update button - EditFields - Kontext "VerknuepfungenBearbeiten" - Aktualisieren.Click - VerknuepfungenBearbeiten.Close + Call hCloseDocument + + '/// Check if the content is changed -- Should NOT + Sleep 2 + Call wTypeKeys "<F9>" + Call wTypeKeys "<MOD1 Home><Shift End>" + if fGetFieldContent() <> sContent then + Warnlog "Should get " & sContent & " but get " & fGetFieldContent() + end if - '/// Check if the content is changed -- Should NOT - Sleep 1 - Call wTypeKeys "<F9>" - Call wTypeKeys "<MOD1 Home><Shift End>" - if fGetFieldContent() <> ("XYZ" & sContent) then - Warnlog "Should get XYZ" & sContent & " but get " & fGetFieldContent() - end if + '/// Edit/Fields , press update button + EditFields + Kontext "VerknuepfungenBearbeiten" + Aktualisieren.Click + VerknuepfungenBearbeiten.Close + + '/// Check if the content is changed -- Should NOT + Sleep 1 + Call wTypeKeys "<F9>" + Call wTypeKeys "<MOD1 Home><Shift End>" + if fGetFieldContent() <> ("XYZ" & sContent) then + Warnlog "Should get XYZ" & sContent & " but get " & fGetFieldContent() + end if - Call hCloseDocument + Call hCloseDocument - if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) + if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) endcase '----------------------------------------------------------------- testcase tVariablesDDEFieldAutomatic + warnlog "#i112079#testcase must be reworked" + goto endsub + qaerrorlog "#i102792# - tVariablesDDEFieldAutomatic outcommented. Fields not updated." goto endsub diff --git a/testautomation/writer/optional/includes/hyphenation/w_hyphenation.inc b/testautomation/writer/optional/includes/hyphenation/w_hyphenation.inc index 93c90a31dec9..01c1bc91a7c4 100644..100755 --- a/testautomation/writer/optional/includes/hyphenation/w_hyphenation.inc +++ b/testautomation/writer/optional/includes/hyphenation/w_hyphenation.inc @@ -173,9 +173,9 @@ testcase tHyphenation_3 printlog "Tools/Hyphenation" ToolsLanguageHyphenate - Kontext "Silbentrennung" + Kontext "Hyphenation" - if Not Silbentrennung.Exists then + if Not Hyphenation.Exists then Warnlog "Unable to bring up Dialog 'Hyphenation'!" Call hCloseDocument goto endsub @@ -184,21 +184,21 @@ testcase tHyphenation_3 printlog "check if get 'fol=low-ing'" if Wort.Gettext <> testWordInHyphenationDlg then Warnlog "Expected " & testWordInHyphenationDlg & " but found " & Wort.Gettext - Silbentrennung.Cancel + Hyphenation.Cancel Call hCloseDocument goto endsub end if if NOT Vor.IsEnabled then Warnlog "the 'Vor' button is Not enabled, or something wrong!" - Silbentrennung.Cancel + Hyphenation.Cancel Call hCloseDocument goto endsub end if printlog "add '-' between 'fol' and 'lowing' using left arrow key" Vor.Click - Silbentrennung.OK + Hyphenation.OK ' Messagebox 'Start hypheantion from the beginning ? Kontext "Active" @@ -285,9 +285,9 @@ testcase tHyphenation_4 printlog "Tools/Hyphenation" ToolsLanguageHyphenate - Kontext "Silbentrennung" + Kontext "Hyphenation" - if Not Silbentrennung.Exists then + if Not Hyphenation.Exists then Call hCloseDocument goto endsub end if @@ -295,7 +295,7 @@ testcase tHyphenation_4 printlog "check if get 'fol=low-ing'" if Wort.Gettext <> testWordInHyphenationDlg1 then Warnlog "Expected " & testWordInHyphenationDlg1 & " but found " & Wort.Gettext - Silbentrennung.Cancel + Hyphenation.Cancel Call hCloseDocument goto endsub end if @@ -303,7 +303,7 @@ testcase tHyphenation_4 printlog "click left arrow key" if NOT Vor.IsEnabled then Warnlog "the Vor button is Not enabled, or something wrong!" - Silbentrennung.Cancel + Hyphenation.Cancel Call hCloseDocument goto endsub end if @@ -334,7 +334,7 @@ testcase tHyphenation_4 Sleep 1 printlog "close all dialogs" - Silbentrennung.OK + Hyphenation.OK ' Messagebox 'Start hypheantion from the beginning ? Kontext "Active" diff --git a/testautomation/writer/optional/includes/number/w_206_.inc b/testautomation/writer/optional/includes/number/w_206_.inc index 9d7750628013..c007e674d329 100644..100755 --- a/testautomation/writer/optional/includes/number/w_206_.inc +++ b/testautomation/writer/optional/includes/number/w_206_.inc @@ -472,12 +472,12 @@ testcase tToolsNumbering7 end if end if Case 2 - if sClipBrd(1) <> "1.My second number" then - Warnlog "#128041#First paragraph not '1.My second number' but: " & sClipBrd(1) + if sClipBrd(1) <> "1.1.My second number" then + Warnlog "#128041#First paragraph not '1.1.My second number' but: " & sClipBrd(1) end if Case 3 - if sClipBrd(2) <> "2.My third number" then - Warnlog "#128041#First paragraph not '2.My third number' but: " & sClipBrd(2) + if sClipBrd(2) <> "2.2.My third number" then + Warnlog "#128041#First paragraph not '2.2.My third number' but: " & sClipBrd(2) end if end select next i @@ -707,16 +707,16 @@ testcase tToolsNumbering11 For i = 1 to 3 Select Case i Case 1 - if sClipBrd(0) <> "1A new first paragraph" then - Warnlog "First Heading not: '1A new first paragraph' but: " & sClipBrd(0) + if sClipBrd(0) <> "11A new first paragraph" then + Warnlog "First Heading not: '11A new first paragraph' but: " & sClipBrd(0) end if Case 2 - if sClipBrd(1) <> "2" then - Warnlog "First paragraph not empty but: " & sClipBrd(1) + if sClipBrd(1) <> "22" then + Warnlog "First paragraph not '22' but: " & sClipBrd(1) end if Case 3 - if sClipBrd(2) <> "3A new third paragraph" then - Warnlog "First paragraph not '3A new third paragraph' but: " & sClipBrd(2) + if sClipBrd(2) <> "33A new third paragraph" then + Warnlog "First paragraph not '33A new third paragraph' but: " & sClipBrd(2) end if end select next i diff --git a/testautomation/writer/optional/includes/regexp/search.inc b/testautomation/writer/optional/includes/regexp/search.inc index ce3d946fe3b9..ccd959504900 100755 --- a/testautomation/writer/optional/includes/regexp/search.inc +++ b/testautomation/writer/optional/includes/regexp/search.inc @@ -1190,7 +1190,7 @@ function wSelectAttributeName(aNumber as integer, AsianSupport as boolean, SetSt Case 31 Select Case iSprache - Case 49: aSelectIt = "Silbentrennung" + Case 49: aSelectIt = "Hyphenation" Case else: Warnlog "Language not supported. No test" exit function end select @@ -1469,7 +1469,7 @@ sub wCheckAttribute(aNumber as integer) Case 28 '"Schriftstellung asiatische Schrift" Case 29 '"Schusterjungen" Case 30 '"Seitenvorlage" - Case 31 '"Silbentrennung" + Case 31 '"Hyphenation" Case 32 '"Skalierung" Case 33 '"Sprache" Case 34 '"Sprache asiatische Schrift" diff --git a/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc b/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc index e4818c34029f..3dfd505d129c 100644..100755 --- a/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc +++ b/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc @@ -1227,11 +1227,9 @@ endcase ' ******************************************************************* testcase tToolsThesaurus + Dim sWordInitial as string - Dim sLanguageToBeSelected as string Dim sWordToBeFound as string - Dim sWordReplacedWith as string - Dim i as integer Dim TheFile as String PrintLog "- Tools / Thesaurus" @@ -1283,19 +1281,20 @@ testcase tToolsThesaurus '/// Call Thesaurus without a written word /// ToolsLanguageThesaurus Kontext "Thesaurus" - if Ersetzen.GetText <> "" then Warnlog "- Though no word has been selected there is a replacetext in the textfield!" - printlog "- enter one word and search" - Ersetzen.SetText sWordInitial - Nachschlagen.Click - Kontext "Active" - if Active.Exists then - Warnlog Active.Gettext - Active.ok - end if - Kontext "Thesaurus" - if Bedeutung.GetSelText(1) = "" then Warnlog "No meaning text" - if Ersetzen.Gettext = "" then Ersetzen.SetText = sWordInitial - sWordToBeFound = Ersetzen.GetText + if CurrentWord.GetSelText <> "" then Warnlog "- Though no word has been selected Current Word textfield is filled !" + if ReplaceWith.GetText <> "" then Warnlog "- Though no word has been selected there is a replacetext in the textfield!" + printlog "Set language dependent word in textfield Current Word" + CurrentWord.Settext sWordInitial + + wait 500 + if Alternatives.GetItemCount = 0 then + Warnlog "No alternatives text" + else + if ReplaceWith.Gettext <> Alternatives.GetText(Alternatives.GetSelIndex) then + Warnlog "Replace with textfield was not filled with word from alternative" + endif + endif + sWordToBeFound = ReplaceWith.GetText Thesaurus.OK Call wTypeKeys "<Home><Shift End>" wait 200 @@ -1310,166 +1309,156 @@ testcase tToolsThesaurus printlog " Open new preformatted-document where the formatting is set to the language we wish to test." call hFileOpen (TheFile,false) - Call sMakeReadOnlyDocumentEditable + Call sMakeReadOnlyDocumentEditable + + Call wTypeKeys sWordInitial + Call wTypeKeys "<Home><Right><Right>" - printlog "- check the language" - Call wTypeKeys sWordInitial + "<Home>" - '/// Check language in Thesaurus /// + printlog "- Replace ( select alternative with cursor within word )" ToolsLanguageThesaurus Kontext "Thesaurus" + wait 500 + if CurrentWord.GetSeltext = sWordInitial then + sWordToBeFound = ReplaceWith.Gettext + if Alternatives.GetItemCount > 0 then + printlog "Select last entry in alternatives list" + Alternatives.Select Alternatives.GetItemCount + Alternatives.TypeKeys "<Space>" + if ReplaceWith.Gettext = sWordToBeFound then + Warnlog "Though alternative was selected replace with was not changed" + else + sWordToBeFound = ReplaceWith.Gettext + end if + Thesaurus.OK + Call wTypeKeys "<Home><Shift End>" + wait 200 + EditCopy + if GetClipboardText <> sWordToBeFound then Warnlog "Text has not been correctly replaced, not => " + sWordToBeFound + " but => " + GetClipboardText + else + Warnlog "- No Alternative for current word" + Thesaurus.Ok + end if + else + Warnlog "Current word is not selected word !" + end if - Sprache.Click - Kontext "SpracheAuswaehlen" - select case iSprache ' iSystemSprache - case 01 : sLanguageToBeSelected = "English (USA)" - case 07 : sLanguageToBeSelected = "РуÑÑкий" - case 03 : sLanguageToBeSelected = "Português" - case 31 : sLanguageToBeSelected = "Nederlands (NL)" - case 33 : sLanguageToBeSelected = "Français (France)" - case 34 : sLanguageToBeSelected = "Español (España)" - case 36 : sLanguageToBeSelected = "Madyar" - case 39 : sLanguageToBeSelected = "Italiano (Italia)" - case 45 : sLanguageToBeSelected = "Dansk" - case 46 : sLanguageToBeSelected = "svenska (Sverige)" - case 48 : sLanguageToBeSelected = "Polski" - case 49 : sLanguageToBeSelected = "Deutsch (Deutschland)" - end select - SpracheAuswaehlen.OK - Sleep 5 - + Call wTypeKeys "<Home><Shift End><Delete>" + Call wTypeKeys sWordInitial + + printlog "- Replace unchecked ( Cursor at words end )" + ToolsLanguageThesaurus Kontext "Thesaurus" - printlog "- Search for a Synonym" - '/// Search for a synonym /// - Synonym.Select 1 - wait 500 - sWordToBeFound = Synonym.GetSelText - if Ersetzen.GetText <> sWordToBeFound then Warnlog "Synonym has not been taken over" - Nachschlagen.Click - wait 500 - if Wort.GetSelText <> sWordToBeFound then Warnlog "Synonym has not been added to the word listand activated" - - printlog "- Search for a meaning" - '/// Search for a meaning /// wait 500 - Bedeutung.Select 1 - wait 500 - Nachschlagen.Click - Sleep 1 - Kontext "Active" - if Active.Exists then - printlog "- " + Active.Gettext - Active.Ok - Kontext "Thesaurus" - else ' Nur wenn Wort auch enthalten ist - Kontext "Thesaurus" - for i = 1 to 100 - if Bedeutung.GetSeltext <> "" then i = 101 - Sleep 1 - next i - sWordToBeFound = Bedeutung.GetSelText - if Instr ( Ersetzen.GetText, sWordToBeFound ) <> 0 then - Warnlog "Meaning has not been overtaken" - end if - end if + if CurrentWord.GetSeltext = sWordInitial then + sWordToBeFound = ReplaceWith.Gettext + if Alternatives.GetItemCount > 0 then + printlog "Select last entry in alternatives list" + Alternatives.Select Alternatives.GetItemCount + Alternatives.TypeKeys "<Space>" + if ReplaceWith.Gettext = sWordToBeFound then + Warnlog "Though alternative was selected replace with was not changed" + else + sWordToBeFound = ReplaceWith.Gettext + end if + Thesaurus.OK + Call wTypeKeys "<Home><Shift End>" + wait 200 + EditCopy + if GetClipboardText <> sWordToBeFound then Warnlog "Text has not been correctly replaced, not => " + sWordToBeFound + " but => " + GetClipboardText + else + Warnlog "- No Alternative for current word" + Thesaurus.Ok + end if + else + Warnlog "Current word is not selected word !" + end if + + '/// Close thesaurus and writerdocument /// + Call hCloseDocument +endcase - printlog "- Replace unchecked ( Cursor in front of words 1. character )" - '/// replace unchecked /// - sWordReplacedWith = Ersetzen.GetText - Thesaurus.OK - Call wTypeKeys "<Shift Home>" - wait 200 - EditCopy - if GetClipboardText <> sWordReplacedWith then Warnlog "Text has not been correctly replaced, not => " + sWordReplacedWith + " but => " + GetClipboardText +' ******************************************************************* - Call wTypeKeys "<End><Shift Home><Delete>" + sWordInitial - Call wTypeKeys "<Home><Right><Right>" +testcase tToolsThesaurusSynonyms - printlog "- Replace unchecked ( Cursor in word )" - ToolsLanguageThesaurus - Kontext "Thesaurus" - wait 500 - if Synonym.GetItemCount >0 then - Synonym.Select 1 - sWordReplacedWith = Ersetzen.GetText - Thesaurus.OK - Call wTypeKeys "<Home><Shift End>" - wait 200 - EditCopy - if GetClipboardText <> sWordReplacedWith then Warnlog "Text has not been correctly replaced, not => " + sWordReplacedWith + " but => " + GetClipboardText - else - Warnlog "- No Synonym when cursor is in word!" - Thesaurus.Ok - end if + Dim sWordInitial as string + Dim sNumberOfSuggestions as string + Dim sReplaceWithWord as string + Dim TheFile as String - Call wTypeKeys "<End><Shift Home><Delete>" - Call wTypeKeys sWordInitial + "<End><Left>" + PrintLog "- Tools / Thesaurus" - printlog "- Replace unchecked ( Cursor at words end )" - ToolsLanguageThesaurus - Kontext "Thesaurus" - if Synonym.GetItemCount >0 then - Synonym.Select 1 - sWordReplacedWith = Ersetzen.GetText - Thesaurus.OK - Call wTypeKeys "<Home><Shift End>" - wait 200 - EditCopy - if GetClipboardText <> sWordReplacedWith then Warnlog "Text has not been correctly replaced, not => " + sWordReplacedWith + " but => " + Trim$(GetClipboardText) - else - Warnlog "- No sysnonym when cursor pointed to words end!" - Thesaurus.Ok + printlog " Open document where the formatting is set to the language we wish to test." + TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") + if hFileExists ( TheFile ) <> TRUE then + Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." + exit sub end if - Call wTypeKeys "<End><Shift Home><Delete>" - Call wTypeKeys sWordInitial + "<End><Left><Shift Mod1 Left>" + select case iSprache + case 01 : sWordInitial = "Morning" + case 03 : sWordInitial = "Confirmam" + case 07 : Printlog "- No Thesaurus in Russian!" + goto endsub + case 31 : sWordInitial = "Hulp" + case 33 : sWordInitial = "Payer" + case 34 : sWordInitial = "Suficiente" + case 36 : Printlog "- No Thesaurus in Hungarian!" + goto endsub + case 39 : sWordInitial = "Lingua" + case 45 : sWordInitial = "Først" + case 46 : sWordInitial = "Däng" + case 48 : sWordInitial = "wypowiedź" + case 49 : sWordInitial = "Mann" + case 55 : Printlog "- No Thesaurus in Portuguese (Brazil) !" + goto endsub + case 81 : Printlog "- No Thesaurus in Japanese!" + goto endsub + case 82 : Printlog "- No Thesaurus in Korean!" + goto endsub + case 86 : Printlog "- No Thesaurus in Chinese (simplified)!" + goto endsub + case 88 : Printlog "- No Thesaurus in Chinese (traditional)!" + goto endsub + case 30, 35, 36, 37, 42, 47, 48, 51, 90 + Printlog "- No Thesaurus available !" + goto endsub + case else : QAErrorlog "The language " + iSprache + " has no defined errortext. No Test!" + goto endsub + end select + + printlog "Open new preformatted-writerdocument" + call hFileOpen (TheFile,false) + Call sMakeReadOnlyDocumentEditable + Call wTypeKeys sWordInitial + Call wTypeKeys "<Shift Home>" - printlog "- Replace checked ( back to front )" - '/// replace checked /// - ToolsLanguageThesaurus - Kontext "Thesaurus" - if Synonym.GetItemCount >0 then - Synonym.Select 1 - sWordReplacedWith = Ersetzen.GetText - Thesaurus.Ok - Call wTypeKeys "<Home><Shift End><Shift Left>" - wait 200 - EditCopy - if GetClipboardText <> sWordReplacedWith then Warnlog "Text has not been correctly replaced, not => " + sWordReplacedWith + " but => " + GetClipboardText + printlog "Open contextmenu in wrong word" + Call wTypeKeys "<Shift F10>" + printlog "Select 'Synonyms' in context menu" + Call hMenuSelectNr (13) + sNumberOfSuggestions=MenuGetItemCount - 2 + '/// Check if there is a suggestion and replace word /// + if sNumberOfSuggestions <=0 then + Warnlog "- No synonyms in Context menu for the first wrong word!" else - Nachschlagen.Click - Kontext "Active" - if Active.Exists then - Active.Ok - Kontext "Thesaurus" - Thesaurus.OK - end if + printlog "- Context menu has " + sNumberOfSuggestions + " synonyms for the 1. wrong word!" + sReplaceWithWord=hMenuItemGetText (1) + Call hMenuSelectNr (1) + Call wTypeKeys "<Shift Mod1 Left>" + try + EditCopy + if GetClipboardtext<> sReplaceWithWord then + Warnlog "- 1. wrong Word has not been replaced with " + sReplaceWithWord + " but "+ GetClipBoardtext + else + printlog "- 1. wrong word has been replaced with the 1. entry in context menu!" + end if + catch + endcatch end if + Call hCloseDocument + +endcase - Call wTypeKeys "<End><Shift Home><Delete>" - Call wTypeKeys sWordInitial + "<Home><Shift End>" - printlog "- Replace checked ( front to back )" - ToolsLanguageThesaurus - Kontext "Thesaurus" - if Synonym.GetItemCount >0 then - Synonym.Select 1 - sWordReplacedWith = Ersetzen.GetText - Thesaurus.Ok - Call wTypeKeys "<Home><Shift End>" - wait 200 - EditCopy - if GetClipboardText <> sWordReplacedWith then Warnlog "Text has not been correctly replaced, not => " + sWordReplacedWith + " but => " + GetClipboardText - else - Warnlog "- No sysnonym when word is marked!" - Thesaurus.Ok - end if - Call wTypeKeys "<End><Shift Home><Delete>" - Call wTypeKeys sWordInitial + "<Home><Right><Shift Right><Shift Right>" - printlog "- Part of Replace checked ( back to front ) - no checking anymore" - ToolsLanguageThesaurus - Kontext "Thesaurus" - Thesaurus.OK - '/// Close thesaurus and writerdocument /// - Call hCloseDocument -endcase diff --git a/testautomation/writer/required/includes/w_005_.inc b/testautomation/writer/required/includes/w_005_.inc index 830ce39adc24..93fe9ac0237b 100644..100755 --- a/testautomation/writer/required/includes/w_005_.inc +++ b/testautomation/writer/required/includes/w_005_.inc @@ -232,14 +232,55 @@ testcase tFormatChangeCase printlog " Open new document" Call hNewDocument printlog " Insert some text in document and select text" - Call wTypeKeys ("Hello World!") + Call wTypeKeys ("call him now ! please") Call wTypeKeys ("<Shift Home>") printlog " Format / Case Characters / Upper" hUseAsyncSlot( "FormatChangeCaseUpper" ) + EditCopy + if GetClipboardtext() <> "CALL HIM NOW ! PLEASE" then + Warnlog "Sentence not 'CALL HIM NOW ! PLEASE' but " & GetClipboardtext() + else + printlog " " & GetClipboardtext() + endif printlog " Format / Case Characters / Lower" hUseAsyncSlot( "FormatChangeCaseLower" ) + EditCopy + if GetClipboardtext() <> "call him now ! please" then + Warnlog "Sentence not 'call him now ! please' but " & GetClipboardtext() + else + printlog " " & GetClipboardtext() + endif + + printlog " Format / Case Characters / Sentence Case" + FormatChangeCaseToSentence + EditCopy + if GetClipboardtext() <> "Call him now ! Please" then + Warnlog "Sentence not 'Call him now ! Please' but " & GetClipboardtext() + else + printlog " " & GetClipboardtext() + endif + + printlog " Format / Case Characters / Capitalize every word" + FormatChangeCaseCapitalizeEveryWord + EditCopy + if GetClipboardtext() <> "Call Him Now ! Please" then + Warnlog "Sentence not 'Call Him Now ! Please' but " & GetClipboardtext() + else + printlog " " & GetClipboardtext() + endif + + + printlog " Format / Case Characters / tOGGLE cASE" + FormatChangeCaseToggleCase + EditCopy + if GetClipboardtext() <> "cALL hIM nOW ! pLEASE" then + Warnlog "Sentence not 'cALL hIM nOW ! pLEASE' but " & GetClipboardtext() + else + printlog " " & GetClipboardtext() + endif + if ( gAsianSup ) then try diff --git a/testautomation/writer/required/includes/w_007_.inc b/testautomation/writer/required/includes/w_007_.inc index 57c83706029f..9b9a19ca8676 100644..100755 --- a/testautomation/writer/required/includes/w_007_.inc +++ b/testautomation/writer/required/includes/w_007_.inc @@ -155,9 +155,9 @@ testcase tToolsSpellcheck if OptionenBearbeiten.IsEnabled then OptionenBearbeiten.Click wait 500 - Kontext "SilbentrennungOptionen" - DialogTest ( SilbentrennungOptionen ) - SilbentrennungOptionen.Cancel + Kontext "HyphenationOptions" + DialogTest ( HyphenationOptions ) + HyphenationOptions.Cancel end if next i @@ -289,13 +289,6 @@ testcase tToolsThesaurus Kontext "Thesaurus" DialogTest ( Thesaurus ) - printlog " In 'Thesaurus' dialog click 'Language'" - Sprache.Click - Kontext "SpracheAuswaehlen" - DialogTest ( SpracheAuswaehlen ) - printlog " Close 'Language' dialog" - SpracheAuswaehlen.Cancel - Kontext "Thesaurus" printlog " Close 'Thesaurus' dialog" Thesaurus.Cancel PrintLog "Close active documents" @@ -390,11 +383,11 @@ testcase tToolsHyphenation end if end if - Kontext "Silbentrennung" + Kontext "Hyphenation" printlog " Close upcoming 'Hyphenation' dialog" - if Silbentrennung.Exists then - Call DialogTest ( Silbentrennung ) - Silbentrennung.Cancel + if Hyphenation.Exists then + Call DialogTest ( Hyphenation ) + Hyphenation.Cancel else Warnlog "Dialog 'Hyphenation' not up!" Kontext "Active" @@ -1294,11 +1287,11 @@ testcase tMasterDocToolsHyphenation end if end if - Kontext "Silbentrennung" + Kontext "Hyphenation" printlog " Close upcoming 'Hyphenation' dialog" - if ( Silbentrennung.Exists( 2 ) ) then - Call DialogTest ( Silbentrennung ) - Silbentrennung.Cancel + if ( Hyphenation.Exists( 2 ) ) then + Call DialogTest ( Hyphenation ) + Hyphenation.Cancel else Warnlog "Dialog 'Hyphenation' not up!" Kontext "Active" diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 9e4f501d1823..88ccb2113e0d 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -209,7 +209,7 @@ static sal_uInt32 GetSvError( int nErrno ) { 0, SVSTREAM_OK }, { EACCES, SVSTREAM_ACCESS_DENIED }, { EBADF, SVSTREAM_INVALID_HANDLE }, -#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) +#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || defined(__FreeBSD_kernel__) { EDEADLK, SVSTREAM_LOCKING_VIOLATION }, #else { EDEADLOCK, SVSTREAM_LOCKING_VIOLATION }, @@ -223,7 +223,7 @@ static sal_uInt32 GetSvError( int nErrno ) { EAGAIN, SVSTREAM_LOCKING_VIOLATION }, { EISDIR, SVSTREAM_PATH_NOT_FOUND }, { ELOOP, SVSTREAM_PATH_NOT_FOUND }, -#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) +#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && ! defined(__FreeBSD_kernel__) { EMULTIHOP, SVSTREAM_PATH_NOT_FOUND }, { ENOLINK, SVSTREAM_PATH_NOT_FOUND }, #endif diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx index 720a2efb381c..9a26bdd73021 100644..100755 --- a/unotools/inc/unotools/lingucfg.hxx +++ b/unotools/inc/unotools/lingucfg.hxx @@ -230,8 +230,10 @@ public: ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - bool HasAnyVendorImages() const; + bool HasVendorImages( const char *pImageName ) const; bool HasGrammarChecker() const; }; diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 35e0fb8af223..39233f022534 100644..100755 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1406,21 +1406,72 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( } -bool SvtLinguConfig::HasAnyVendorImages() const +::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const { - bool bRes = false; - try + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; + +::rtl::OUString SvtLinguConfig::GetSynonymsContextImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; } - catch (uno::Exception &) + return aRes; +} + + +bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const +{ + bool bRes = false; + if (pImageName) { - DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); + sal_Int32 nVendors = aElementNames.getLength(); + const rtl::OUString *pVendor = aElementNames.getConstArray(); + for (sal_Int32 i = 0; i < nVendors; ++i) + { + uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() ); + sal_Int32 nProps = aPropNames.getLength(); + const rtl::OUString *pPropNames = aPropNames.getConstArray(); + for (sal_Int32 k = 0; k < nProps; ++k) + { + // for a quicker check we ignore the HC image names here + const OUString &rName = pPropNames[k]; + if (rName.equalsAscii( pImageName )) + { + bRes = true; + break; + } + } + } + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "exception caught. HasVendorImages failed" ); + } } return bRes; } diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index 062e34286d4b..a10a52802e19 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -31,11 +31,12 @@ #include <unotools/transliterationwrapper.hxx> #include <tools/debug.hxx> #include <i18npool/mslangid.hxx> -#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_ #include <comphelper/componentfactory.hxx> -#endif + #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #define TRANSLIT_LIBRARYNAME "i18n" #define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration" @@ -147,7 +148,10 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const { return TransliterationModules_UPPERCASE_LOWERCASE == nType || TransliterationModules_LOWERCASE_UPPERCASE == nType || - TransliterationModules_IGNORE_CASE == nType; + TransliterationModules_IGNORE_CASE == nType || + (sal_uInt32) TransliterationModulesExtra::SENTENCE_CASE == (sal_uInt32) nType || + (sal_uInt32) TransliterationModulesExtra::TITLE_CASE == (sal_uInt32) nType || + (sal_uInt32) TransliterationModulesExtra::TOGGLE_CASE == (sal_uInt32) nType; } @@ -165,14 +169,32 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang ) sal_Bool bLoad = bFirstCall; bFirstCall = sal_False; - if( nLanguage != nLang ) + if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE ) { - setLanguageLocaleImpl( nLang ); - if( !bLoad ) - bLoad = needLanguageForTheMode(); + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang); + } + else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TITLE_CASE ) + { + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("TITLE_CASE"), nLang); + } + else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TOGGLE_CASE ) + { + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("TOGGLE_CASE"), nLang); + } + else + { + if( nLanguage != nLang ) + { + setLanguageLocaleImpl( nLang ); + if( !bLoad ) + bLoad = needLanguageForTheMode(); + } + if( bLoad ) + loadModuleImpl(); } - if( bLoad ) - loadModuleImpl(); } diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx index eba5109c7446..5472b32dd62f 100644 --- a/vcl/inc/vcl/graphite_cache.hxx +++ b/vcl/inc/vcl/graphite_cache.hxx @@ -127,7 +127,7 @@ public: } m_segMap.clear(); }; - GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl) + GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl, int segCharLimit) { GrSegRecord * found = NULL; // try to find a segment starting at correct place, if not, try to find a @@ -152,8 +152,6 @@ public: if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos && found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos) { - const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos - + GraphiteLayout::EXTRA_CONTEXT_LENGTH); DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache"); // restore original start character, in case it has changed found->m_seg->setTextSourceOffset(found->m_startChar); @@ -161,7 +159,7 @@ public: // interest // We could use substr and ==, but substr does a copy, // so its probably faster to do it like this - for (size_t i = layoutArgs.mnMinCharPos; i < seg_char_limit; i++) + for (int i = layoutArgs.mnMinCharPos; i < segCharLimit; i++) { //if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter())) if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i]) @@ -171,6 +169,15 @@ public: { return NULL; } + if (found->m_seg->stopCharacter() > layoutArgs.mnEndCharPos && + static_cast<int>(found->char2BaseGlyph().size()) > layoutArgs.mnEndCharPos) + { + // check that the requested end character isn't mid cluster + if (found->char2BaseGlyph()[layoutArgs.mnEndCharPos-layoutArgs.mnMinCharPos] == -1) + { + return NULL; + } + } // if (found->m_lockCount != 0) // OutputDebugString("Multple users of SegRecord!"); found->m_lockCount++; @@ -183,10 +190,8 @@ public: // this is expecially needed when editing a large paragraph // each edit changes the pointers, but if we don't reuse any segments it gets very // slow. - const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos - + GraphiteLayout::EXTRA_CONTEXT_LENGTH); rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos, - seg_char_limit - layoutArgs.mnMinCharPos); + segCharLimit - layoutArgs.mnMinCharPos); if (!rope) return NULL; size_t nHash = (*(rope)).hashCode(); GrRMEntry range = m_ropeMap.equal_range(nHash); diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx index 1fbb11211ca0..520f4620cd90 100644 --- a/vcl/inc/vcl/graphite_layout.hxx +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -75,6 +75,14 @@ namespace grutils { class GrFeatureParser; } class VCL_DLLPUBLIC GraphiteLayout : public SalLayout { public: + // Mask to allow Word break status to be stored within mvChar2BaseGlyph + enum { + WORD_BREAK_BEFORE = 0x40000000, + HYPHEN_BREAK_BEFORE = 0x80000000, + BREAK_MASK = 0xC0000000, + GLYPH_INDEX_MASK = 0x3FFFFFFF + } LineBreakMask; + class Glyphs : public std::vector<GlyphItem> { public: @@ -159,6 +167,7 @@ private: std::pair<int,int> glyph_to_chars(const GlyphItem &) const; std::pair<long,long> caret_positions(size_t) const; + void expandOrCondense(ImplLayoutArgs &rArgs); }; diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 6e75d1fde868..ff2fd8f306b1 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -353,6 +353,46 @@ std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg, assert(size() < rGlyph2Char.size()); rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] = size(); rGlyph2Char[size()] = nFirstCharInCluster; + + // can we break before this cluster? + // Glyphs may have either a positive or negative breakWeight refering to + // the position after or before the glyph respectively + int nPrevBreakWeight = 0; + if (nFirstGlyphInCluster > 0) + { + nPrevBreakWeight = (iGlyphs.first + (nFirstGlyphInCluster - 1))->breakweight(); + } + int nBreakWeight = aFirstGlyph.breakweight(); + if (nBreakWeight < 0) + { + // negative means it applies to the position before the glyph's character + nBreakWeight *= -1; + if (nPrevBreakWeight > 0 && nPrevBreakWeight < nBreakWeight) + { + // prevBreakWeight wins + nBreakWeight = nPrevBreakWeight; + } + } + else + { + nBreakWeight = 0; + // positive means break after + if (nPrevBreakWeight > 0) + nBreakWeight = nPrevBreakWeight; + } + if (nBreakWeight > gr::klbNoBreak/*0*/ && + // nBreakWeight <= gr::klbHyphenBreak) // uses Graphite hyphenation + nBreakWeight <= gr::klbLetterBreak) // Needed for issue 111272 + { + if (nBreakWeight < gr::klbHyphenBreak) + rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE; + else + rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= HYPHEN_BREAK_BEFORE; + } + // always allow a break before a space even if graphite doesn't + if (rArgs.mpStr[nFirstCharInCluster] == 0x20) + rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE; + bool bBaseGlyph = true; for (int j = nFirstGlyphInCluster; j != nNextGlyph; j += nDelta) @@ -409,7 +449,7 @@ std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg, } } #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset()); + fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f bw%d\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset(), nBreakWeight); #endif return aBounds; } @@ -641,6 +681,19 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl)) maLayout.setRightToLeft(bRtl); + // Context is often needed beyond the specified end, however, we don't + // want it if there has been a direction change, since it is hard + // to tell between reordering within one direction and multi-directional + // text. Extra context, can also cause problems with ligatures stradling + // a hyphenation point, so disable if CTL is disabled. + const int nSegCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); + int limit = rArgs.mnEndCharPos; + if ((nSegCharLimit > limit) && !(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags)) + { + limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos, + nSegCharLimit - rArgs.mnEndCharPos, bRtl); + } + #ifdef GRCACHE GrFontHasher hasher(mrFont); sal_Int32 aFontHash = hasher.hashCode(mpFeatures); @@ -648,7 +701,7 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) (GraphiteCacheHandler::instance).getCache(aFontHash); if (pCache) { - *pSegRecord = pCache->getSegment(rArgs, bRtl); + *pSegRecord = pCache->getSegment(rArgs, bRtl, nSegCharLimit); if (*pSegRecord) { pSegment = (*pSegRecord)->getSegment(); @@ -667,18 +720,6 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) } #endif - // Context is often needed beyond the specified end, however, we don't - // want it if there has been a direction change, since it is hard - // to tell between reordering within one direction and multi-directional - // text. - const int segCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); - int limit = rArgs.mnEndCharPos; - if (segCharLimit > limit) - { - limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos, - segCharLimit - rArgs.mnEndCharPos, bRtl); - } - // Create a new TextSource object for the engine. mpTextSrc = new TextSourceAdaptor(rArgs, limit); if (mpFeatures) mpTextSrc->setFeatures(mpFeatures); @@ -795,27 +836,35 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment) int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) const { - // Adjust maxmnWidth so FindNextBreakPoint returns a sensible answer. - maxmnWidth -= (mnEndCharPos-mnMinCharPos-1)*char_extra; // extra character spacing. - maxmnWidth /= factor; // scaling factor. +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(),"Gr::GetTextBreak c[%d-%d) maxWidth %ld char extra %ld factor %d\n", + mnMinCharPos, mnEndCharPos, maxmnWidth, char_extra, factor); +#endif - // Ask the segment for the nearest whole letter break for the width. - //float width; - float targetWidth = maxmnWidth/mfScaling; // return quickly if this segment is narrower than the target width - // (sometimes graphite doesn't seem to realise this!) - if (targetWidth > mnWidth) + if (maxmnWidth > mnWidth * factor + char_extra * (mnEndCharPos - mnMinCharPos - 1)) return STRING_LEN; - //int nBreak = mpSegment->findNextBreakPoint(mnMinCharPos, - // gr::klbWordBreak, gr::klbLetterBreak, targetWidth, &width); - // LineFillSegment seems to give better results that findNextBreakPoint - // though it may be slower - gr::LayoutEnvironment aLE; - gr::LineFillSegment lineSeg(const_cast<gr::Font *>(&mrFont), mpTextSrc, &aLE, - mnMinCharPos, mpTextSrc->getContextLength(), - targetWidth); - int nBreak = lineSeg.stopCharacter(); + long nWidth = mvCharDxs[0] * factor; + int nLastBreak = -1; + for (size_t i = 1; i < mvCharDxs.size(); i++) + { + nWidth += char_extra; + if (nWidth > maxmnWidth) break; + if (mvChar2BaseGlyph[i] != -1) + { + if (mvChar2BaseGlyph[i] & (WORD_BREAK_BEFORE | HYPHEN_BREAK_BEFORE)) + nLastBreak = static_cast<int>(i); + } + nWidth += (mvCharDxs[i] - mvCharDxs[i-1]) * factor; + } + int nBreak = mnMinCharPos; + if (nLastBreak > -1) + nBreak += nLastBreak; + +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(), "Gr::GetTextBreak break after %d\n", nBreak - mnMinCharPos); +#endif if (nBreak > mnEndCharPos) nBreak = STRING_LEN; else if (nBreak < mnMinCharPos) nBreak = mnMinCharPos; @@ -833,9 +882,10 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const { for (size_t i = 0; i < mvCharDxs.size(); i++) { - assert((mvChar2BaseGlyph[i] >= -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size())); + assert( (mvChar2BaseGlyph[i] == -1) || + ((signed)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size())); if (mvChar2BaseGlyph[i] != -1 && - mvGlyphs[mvChar2BaseGlyph[i]].mnGlyphIndex == GF_DROPPED) + mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED) { // when used in MultiSalLayout::GetTextBreak dropped glyphs // must have zero width @@ -865,7 +915,6 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); - if(rArgs.mpDXArray) { std::vector<int> vDeltaWidths(mvGlyphs.size(), 0); @@ -894,8 +943,75 @@ void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs) } } } + else if (rArgs.mnLayoutWidth > 0) + { +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(), "AdjustLayout width %ld=>%ld\n", mnWidth, rArgs.mnLayoutWidth); +#endif + expandOrCondense(rArgs); + } } +void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) +{ + int nDeltaWidth = rArgs.mnLayoutWidth - mnWidth; + if (nDeltaWidth > 0) // expand, just expand between clusters + { + int nClusterCount = 0; + for (size_t j = 0; j < mvGlyphs.size(); j++) + { + if (mvGlyphs[j].IsClusterStart()) + { + ++nClusterCount; + } + } + if (nClusterCount > 1) + { + float fExtraPerCluster = static_cast<float>(nDeltaWidth) / static_cast<float>(nClusterCount - 1); + int nCluster = 0; + int nOffset = 0; + for (size_t i = 0; i < mvGlyphs.size(); i++) + { + if (mvGlyphs[i].IsClusterStart()) + { + nOffset = fExtraPerCluster * nCluster; + size_t nCharIndex = mvGlyph2Char[i]; + mvCharDxs[nCharIndex] += nOffset; + // adjust char dxs for rest of characters in cluster + while (++nCharIndex < mvGlyph2Char.size()) + { + int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK; + if (nChar2Base == -1 || nChar2Base == static_cast<int>(i)) + mvCharDxs[nCharIndex] += nOffset; + } + ++nCluster; + } + mvGlyphs[i].maLinearPos.X() += nOffset; + } + } + } + else // condense - apply a factor to all glyph positions + { + if (mvGlyphs.size() == 0) return; + Glyphs::iterator iLastGlyph = mvGlyphs.begin() + (mvGlyphs.size() - 1); + // position last glyph using original width + float fXFactor = static_cast<float>(rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth) / static_cast<float>(iLastGlyph->maLinearPos.X()); +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(), "Condense by factor %f\n", fXFactor); +#endif + iLastGlyph->maLinearPos.X() = rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth; + Glyphs::iterator iGlyph = mvGlyphs.begin(); + while (iGlyph != iLastGlyph) + { + iGlyph->maLinearPos.X() = static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor; + ++iGlyph; + } + for (size_t i = 0; i < mvCharDxs.size(); i++) + { + mvCharDxs[i] = fXFactor * static_cast<float>(mvCharDxs[i]); + } + } +} void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDeltaWidth) { @@ -917,37 +1033,39 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt int nPrevClusterLastChar = -1; for (size_t i = 0; i < nChars; i++) { - if (mvChar2BaseGlyph[i] > -1 && mvChar2BaseGlyph[i] != nPrevClusterGlyph) + int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK; + if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph)) { - assert((mvChar2BaseGlyph[i] > -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size())); - GlyphItem & gi = mvGlyphs[mvChar2BaseGlyph[i]]; + assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size())); + GlyphItem & gi = mvGlyphs[nChar2Base]; if (!gi.IsClusterStart()) continue; // find last glyph of this cluster size_t j = i + 1; int nLastChar = i; - int nLastGlyph = mvChar2BaseGlyph[i]; + int nLastGlyph = nChar2Base; for (; j < nChars; j++) { - assert((mvChar2BaseGlyph[j] >= -1) && (mvChar2BaseGlyph[j] < (signed)mvGlyphs.size())); - if (mvChar2BaseGlyph[j] != -1 && mvGlyphs[mvChar2BaseGlyph[j]].IsClusterStart()) + int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK; + assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size())); + if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart()) { - nLastGlyph = mvChar2BaseGlyph[j] + ((bRtl)? 1 : -1); + nLastGlyph = nChar2BaseJ + ((bRtl)? 1 : -1); nLastChar = j - 1; break; } } if (nLastGlyph < 0) { - nLastGlyph = mvChar2BaseGlyph[i]; + nLastGlyph = nChar2Base; } // Its harder to find the last glyph rtl, since the first of // cluster is still on the left so we need to search towards // the previous cluster to the right if (bRtl) { - nLastGlyph = mvChar2BaseGlyph[i]; + nLastGlyph = nChar2Base; while (nLastGlyph + 1 < (signed)mvGlyphs.size() && !mvGlyphs[nLastGlyph+1].IsClusterStart()) { @@ -983,7 +1101,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt // update glyph positions if (bRtl) { - for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++) + for (int n = nChar2Base; n <= nLastGlyph; n++) { assert((n > - 1) && (n < (signed)mvGlyphs.size())); mvGlyphs[n].maLinearPos.X() += -nDGlyphOrigin + nXOffset; @@ -991,17 +1109,17 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt } else { - for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++) + for (int n = nChar2Base; n <= nLastGlyph; n++) { assert((n > - 1) && (n < (signed)mvGlyphs.size())); mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + nXOffset; } } - rDeltaWidth[mvChar2BaseGlyph[i]] = nDWidth; + rDeltaWidth[nChar2Base] = nDWidth; #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, mvChar2BaseGlyph[i], nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[mvChar2BaseGlyph[i]].maLinearPos.X()); + fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, nChar2Base, nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[nChar2Base].maLinearPos.X()); #endif - nPrevClusterGlyph = mvChar2BaseGlyph[i]; + nPrevClusterGlyph = nChar2Base; nPrevClusterLastChar = nLastChar; i = nLastChar; } @@ -1043,7 +1161,7 @@ void GraphiteLayout::kashidaJustify(std::vector<int>& rDeltaWidths, sal_GlyphId continue; } // calculate gap, ignore if too small - int nGapWidth = rDeltaWidths[nOrigGlyphIndex];; + int nGapWidth = rDeltaWidths[nOrigGlyphIndex]; // worst case is one kashida even for mini-gaps if( 3 * nGapWidth < nKashidaWidth ) { @@ -1104,13 +1222,14 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray { if (mvChar2BaseGlyph[nCharSlot] != -1) { - assert((mvChar2BaseGlyph[nCharSlot] > -1) && (mvChar2BaseGlyph[nCharSlot] < (signed)mvGlyphs.size())); - GlyphItem gi = mvGlyphs[mvChar2BaseGlyph[nCharSlot]]; + int nChar2Base = mvChar2BaseGlyph[nCharSlot] & GLYPH_INDEX_MASK; + assert((mvChar2BaseGlyph[nCharSlot] > -1) && (nChar2Base < (signed)mvGlyphs.size())); + GlyphItem gi = mvGlyphs[nChar2Base]; if (gi.mnGlyphIndex == GF_DROPPED) { continue; } - int nCluster = mvChar2BaseGlyph[nCharSlot]; + int nCluster = nChar2Base; long origClusterWidth = gi.mnNewWidth; long nMin = gi.maLinearPos.X(); long nMax = gi.maLinearPos.X() + gi.mnNewWidth; @@ -1135,7 +1254,7 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray pCaretXArray[i] = nMin; pCaretXArray[i+1] = nMax; } - prevBase = mvChar2BaseGlyph[nCharSlot]; + prevBase = nChar2Base; prevClusterWidth = origClusterWidth; } else if (prevBase > -1) @@ -1268,7 +1387,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, #ifdef GRLAYOUT_DEBUG fprintf(grLog(),"GetNextGlyphs g%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", glyph_slot - 1, - mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance, + GLYPH_INDEX_MASK&mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance, aPosOut.X(), aPosOut.Y()); #endif diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index b4f4d0f2b6df..d4ee01c26d61 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -200,7 +200,11 @@ void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL bMod1 ) BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) { nFlags &= (~SELENG_CMDEVT); - if ( !pFunctionSet || !pWin || rMEvt.GetClicks() > 1 || rMEvt.IsRight() ) + if ( !pFunctionSet || !pWin ) + return FALSE; + const bool bRightClickCursorPositioning = + rMEvt.IsRight() && rMEvt.GetClicks() == 1 && !IsInSelection(); + if ( (rMEvt.GetClicks() > 1 || rMEvt.IsRight()) && !bRightClickCursorPositioning ) return FALSE; USHORT nModifier = rMEvt.GetModifier() | nLockedMods; diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx index d6227754a5f2..49a471a31729 100644 --- a/xmloff/inc/SchXMLExport.hxx +++ b/xmloff/inc/SchXMLExport.hxx @@ -81,7 +81,7 @@ public: void SetProgress( sal_Int32 nPercentage ); - UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return maExportHelper.GetPropertySetMapper(); } + UniReference< XMLPropertySetMapper > GetPropertySetMapper() const; // XServiceInfo ( : SvXMLExport ) virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx index 858371a1805b..7168b2b811a8 100644 --- a/xmloff/inc/SchXMLImport.hxx +++ b/xmloff/inc/SchXMLImport.hxx @@ -69,6 +69,8 @@ enum SchXMLChartElemTokenMap enum SchXMLPlotAreaElemTokenMap { + XML_TOK_PA_COORDINATE_REGION_EXT, + XML_TOK_PA_COORDINATE_REGION, XML_TOK_PA_AXIS, XML_TOK_PA_SERIES, XML_TOK_PA_WALL, diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx index 49c484a1ab17..e7891b36ef17 100644 --- a/xmloff/inc/xmlnmspe.hxx +++ b/xmloff/inc/xmlnmspe.hxx @@ -87,8 +87,9 @@ const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key; XML_NAMESPACE_EXT( OFFICE, 37U ) XML_NAMESPACE_EXT( TABLE, 38U ) +XML_NAMESPACE_EXT( CHART, 39U ) -#define _XML_OLD_NAMESPACE_BASE 39U +#define _XML_OLD_NAMESPACE_BASE 40U // namespaces used in the technical preview (SO 5.2) XML_OLD_NAMESPACE( FO, 0U ) diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx index 64f579a7c252..bf60d44d63fd 100644 --- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx +++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx @@ -40,41 +40,9 @@ #include <queue> #include <vector> -namespace com { namespace sun { namespace star { - namespace chart { - class XDiagram; - class XChartDocument; - struct ChartSeriesAddress; - } - namespace chart2 { - class XDiagram; - class XChartDocument; - class XDataSeries; - namespace data - { - class XDataProvider; - class XDataSequence; - } - } - namespace drawing { - class XShape; - class XShapes; - } - namespace task { - class XStatusIndicator; - } - namespace frame { - class XModel; - } - namespace xml { - namespace sax { - class XAttributeList; -}}}}} - class SvXMLAutoStylePoolP; -class XMLChartExportPropertyMapper; class SvXMLExport; -class XMLPropertyHandlerFactory; +class SchXMLExportHelper_Impl; /** With this class you can export a <chart:chart> element containing its data as <table:table> element or without internal table. In @@ -84,153 +52,22 @@ class XMLPropertyHandlerFactory; class XMLOFF_DLLPUBLIC SchXMLExportHelper : public UniRefBase { public: - // first: data sequence for label, second: data sequence for values. - typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >, - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair; - typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont; - -private: - SvXMLExport& mrExport; - SvXMLAutoStylePoolP& mrAutoStylePool; - UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory; - UniReference< XMLPropertySetMapper > mxPropertySetMapper; - UniReference< XMLChartExportPropertyMapper > mxExpPropMapper; - - rtl::OUString msTableName; - rtl::OUStringBuffer msStringBuffer; - rtl::OUString msString; - - // members filled by InitRangeSegmentationProperties (retrieved from DataProvider) - sal_Bool mbHasSeriesLabels; - sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false - sal_Bool mbRowSourceColumns; - rtl::OUString msChartAddress; - rtl::OUString msTableNumberList; - ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping; - - rtl::OUString msCLSID; - - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; - - tDataSequenceCont m_aDataSequencesToExport; - rtl::OUString maCategoriesRange; - - /** first parseDocument: collect autostyles and store names in this queue - second parseDocument: export content and use names from this queue - */ - ::std::queue< ::rtl::OUString > maAutoStyleNameQueue; - SAL_DLLPRIVATE void CollectAutoStyle( - const std::vector< XMLPropertyState >& aStates ); - SAL_DLLPRIVATE void AddAutoStyleAttribute( - const std::vector< XMLPropertyState >& aStates ); - - SAL_DLLPRIVATE SvXMLAutoStylePoolP& GetAutoStylePoolP() - { return mrAutoStylePool; } - - /// if bExportContent is false the auto-styles are collected - SAL_DLLPRIVATE void parseDocument( com::sun::star::uno::Reference< - com::sun::star::chart::XChartDocument >& rChartDoc, - sal_Bool bExportContent, - sal_Bool bIncludeTable = sal_False ); - SAL_DLLPRIVATE void exportTable(); - SAL_DLLPRIVATE void exportPlotArea( - com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram, - com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram, - const ::com::sun::star::awt::Size & rPageSize, - sal_Bool bExportContent, - sal_Bool bIncludeTable ); - SAL_DLLPRIVATE void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram, - const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, - sal_Bool bExportContent ); - - SAL_DLLPRIVATE void exportSeries( - const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, - const ::com::sun::star::awt::Size & rPageSize, - sal_Bool bExportContent, - sal_Bool bHasTwoYAxes ); - SAL_DLLPRIVATE void exportCandleStickSeries( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq, - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDiagram > & xDiagram, - sal_Bool bJapaneseCandleSticks, - sal_Bool bExportContent ); - SAL_DLLPRIVATE void exportDataPoints( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & xSeriesProperties, - sal_Int32 nSeriesLength, - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDiagram > & xDiagram, - sal_Bool bExportContent ); - SAL_DLLPRIVATE void exportRegressionCurve( - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDataSeries > & xSeries, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & xSeriesProp, - const ::com::sun::star::awt::Size & rPageSize, - sal_Bool bExportContent ); - - /// add svg position as attribute for current element - SAL_DLLPRIVATE void addPosition( const ::com::sun::star::awt::Point & rPosition ); - SAL_DLLPRIVATE void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); - /// add svg size as attribute for current element - SAL_DLLPRIVATE void addSize( const ::com::sun::star::awt::Size & rSize ); - SAL_DLLPRIVATE void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); - /// fills the member msString with the appropriate String (i.e. "A3") - SAL_DLLPRIVATE void getCellAddress( sal_Int32 nCol, sal_Int32 nRow ); - /// exports a string as a paragraph element - SAL_DLLPRIVATE void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false ); - SAL_DLLPRIVATE void exportErrorBarRanges(); - - SAL_DLLPRIVATE SchXMLExportHelper(SchXMLExportHelper &); // not defined - SAL_DLLPRIVATE void operator =(SchXMLExportHelper &); // not defined - -public: SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ); virtual ~SchXMLExportHelper(); - // auto-styles - /// parse chart and collect all auto-styles used in current pool - void collectAutoStyles( com::sun::star::uno::Reference< - com::sun::star::chart::XChartDocument > rChartDoc ); - /// write the styles collected into the current pool as <style:style> elements - void exportAutoStyles(); - - /** export the <chart:chart> element corresponding to rChartDoc - if bIncludeTable is true, the chart data is exported as <table:table> - element (inside the chart element). - - Otherwise the external references stored in the chart document are used - for writing the corresponding attributes at series - - All attributes contained in xAttrList are written at the chart element, - which ist the outer element of a chart. So these attributes can easily - be parsed again by the container - */ - void exportChart( com::sun::star::uno::Reference< - com::sun::star::chart::XChartDocument > rChartDoc, - sal_Bool bIncludeTable ); - /// returns the string corresponding to the current FileFormat CLSID for Chart const rtl::OUString& getChartCLSID(); - UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return mxPropertySetMapper; } - - void SetChartRangeAddress( const ::rtl::OUString& rAddress ) - { msChartAddress = rAddress; } - void SetTableNumberList( const ::rtl::OUString& rList ) - { msTableNumberList = rList; } - - void InitRangeSegmentationProperties( - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > & xChartDoc ); +private: + SchXMLExportHelper(); // not defined + SchXMLExportHelper(SchXMLExportHelper &); // not defined + void operator =(SchXMLExportHelper &); // not defined - ::com::sun::star::awt::Size getPageSize( - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const; +private: + SchXMLExportHelper_Impl* m_pImpl; + friend class SchXMLExport; }; #endif // _XMLOFF_SCH_XMLEXPORTHELPER_HXX_ diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 82dc69e59ee3..06b057a3e91d 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3095,6 +3095,11 @@ namespace xmloff { namespace token { XML_ENDS_WITH, XML_DOES_NOT_END_WITH, + //chart + XML_NP_CHART_EXT, + XML_N_CHART_EXT, + XML_COORDINATE_REGION, + XML_TOKEN_END }; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index ccc400305044..c4abc4172959 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -76,6 +76,7 @@ #include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp> #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> @@ -116,6 +117,161 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::std::vector; +// ======================================== +// class SchXMLExportHelper_Impl +// ======================================== + +class SchXMLExportHelper_Impl +{ +public: + // first: data sequence for label, second: data sequence for values. + typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >, + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair; + typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont; + +public: + SchXMLExportHelper_Impl( SvXMLExport& rExport, + SvXMLAutoStylePoolP& rASPool ); + + virtual ~SchXMLExportHelper_Impl(); + + // auto-styles + /// parse chart and collect all auto-styles used in current pool + void collectAutoStyles( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc ); + + /// write the styles collected into the current pool as <style:style> elements + void exportAutoStyles(); + + /** export the <chart:chart> element corresponding to rChartDoc + if bIncludeTable is true, the chart data is exported as <table:table> + element (inside the chart element). + + Otherwise the external references stored in the chart document are used + for writing the corresponding attributes at series + + All attributes contained in xAttrList are written at the chart element, + which ist the outer element of a chart. So these attributes can easily + be parsed again by the container + */ + void exportChart( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc, + sal_Bool bIncludeTable ); + + UniReference< XMLPropertySetMapper > GetPropertySetMapper() const; + + void SetChartRangeAddress( const ::rtl::OUString& rAddress ) + { msChartAddress = rAddress; } + void SetTableNumberList( const ::rtl::OUString& rList ) + { msTableNumberList = rList; } + + void InitRangeSegmentationProperties( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); + + ::com::sun::star::awt::Size getPageSize( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const; + + /** first parseDocument: collect autostyles and store names in this queue + second parseDocument: export content and use names from this queue + */ + ::std::queue< ::rtl::OUString > maAutoStyleNameQueue; + void CollectAutoStyle( + const std::vector< XMLPropertyState >& aStates ); + void AddAutoStyleAttribute( + const std::vector< XMLPropertyState >& aStates ); + + SvXMLAutoStylePoolP& GetAutoStylePoolP() + { return mrAutoStylePool; } + + /// if bExportContent is false the auto-styles are collected + void parseDocument( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument >& rChartDoc, + sal_Bool bExportContent, + sal_Bool bIncludeTable = sal_False ); + void exportTable(); + void exportPlotArea( + com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram, + com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram, + const ::com::sun::star::awt::Size & rPageSize, + sal_Bool bExportContent, + sal_Bool bIncludeTable ); + void exportCoordinateRegion( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram ); + void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram, + const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, + sal_Bool bExportContent ); + + void exportSeries( + const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, + const ::com::sun::star::awt::Size & rPageSize, + sal_Bool bExportContent, + sal_Bool bHasTwoYAxes ); + void exportCandleStickSeries( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + sal_Bool bJapaneseCandleSticks, + sal_Bool bExportContent ); + void exportDataPoints( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, + sal_Int32 nSeriesLength, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + sal_Bool bExportContent ); + void exportRegressionCurve( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProp, + const ::com::sun::star::awt::Size & rPageSize, + sal_Bool bExportContent ); + + /// add svg position as attribute for current element + void addPosition( const ::com::sun::star::awt::Point & rPosition ); + void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); + /// add svg size as attribute for current element + void addSize( const ::com::sun::star::awt::Size & rSize ); + void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); + /// fills the member msString with the appropriate String (i.e. "A3") + void getCellAddress( sal_Int32 nCol, sal_Int32 nRow ); + /// exports a string as a paragraph element + void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false ); + void exportErrorBarRanges(); + + SchXMLExportHelper_Impl(SchXMLExportHelper_Impl &); // not defined + void operator =(SchXMLExportHelper_Impl &); // not defined + +public: + SvXMLExport& mrExport; + SvXMLAutoStylePoolP& mrAutoStylePool; + UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory; + UniReference< XMLPropertySetMapper > mxPropertySetMapper; + UniReference< XMLChartExportPropertyMapper > mxExpPropMapper; + + rtl::OUString msTableName; + rtl::OUStringBuffer msStringBuffer; + rtl::OUString msString; + + // members filled by InitRangeSegmentationProperties (retrieved from DataProvider) + sal_Bool mbHasSeriesLabels; + sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false + sal_Bool mbRowSourceColumns; + rtl::OUString msChartAddress; + rtl::OUString msTableNumberList; + ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping; + + rtl::OUString msCLSID; + + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; + + tDataSequenceCont m_aDataSequencesToExport; + rtl::OUString maCategoriesRange; +}; + namespace { Reference< uno::XComponentContext > lcl_getComponentContext() @@ -354,7 +510,7 @@ tLabelAndValueRange lcl_getLabelAndValueRangeByRole( const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt, const OUString & rRole, const Reference< chart2::XChartDocument > & xDoc, - SchXMLExportHelper::tDataSequenceCont & rOutSequencesToExport ) + SchXMLExportHelper_Impl::tDataSequenceCont & rOutSequencesToExport ) { tLabelAndValueRange aResult; @@ -371,7 +527,7 @@ tLabelAndValueRange lcl_getLabelAndValueRangeByRole( aResult.second = lcl_ConvertRange( xValueSeq->getSourceRangeRepresentation(), xDoc ); if( xLabelSeq.is() || xValueSeq.is()) - rOutSequencesToExport.push_back( SchXMLExportHelper::tLabelValuesDataPair( xLabelSeq, xValueSeq )); + rOutSequencesToExport.push_back( SchXMLExportHelper_Impl::tLabelValuesDataPair( xLabelSeq, xValueSeq )); } return aResult; @@ -453,10 +609,10 @@ OUString lcl_getLabelString( const Reference< chart2::data::XDataSequence > & xL } sal_Int32 lcl_getMaxSequenceLength( - const SchXMLExportHelper::tDataSequenceCont & rContainer ) + const SchXMLExportHelper_Impl::tDataSequenceCont & rContainer ) { sal_Int32 nResult = 0; - for( SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( rContainer.begin()); + for( SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( rContainer.begin()); aIt != rContainer.end(); ++aIt ) { if( aIt->second.is()) @@ -571,7 +727,7 @@ template< class T > }; -typedef ::std::map< sal_Int32, SchXMLExportHelper::tLabelValuesDataPair > +typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair > lcl_DataSequenceMap; struct lcl_SequenceToMapElement : @@ -594,7 +750,7 @@ struct lcl_SequenceToMapElement : }; void lcl_ReorderInternalSequencesAccordingToTheirRangeName( - SchXMLExportHelper::tDataSequenceCont & rInOutSequences ) + SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences ) { lcl_DataSequenceMap aIndexSequenceMap; ::std::transform( rInOutSequences.begin(), rInOutSequences.end(), @@ -611,7 +767,7 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName( // fill empty columns for( ; nIndex < aIt->first; ++nIndex ) rInOutSequences.push_back( - SchXMLExportHelper::tDataSequenceCont::value_type( 0, 0 )); + SchXMLExportHelper_Impl::tDataSequenceCont::value_type( 0, 0 )); OSL_ASSERT( nIndex == aIt->first ); rInOutSequences.push_back( aIt->second ); } @@ -619,7 +775,7 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName( lcl_TableData lcl_getDataForLocalTable( - const SchXMLExportHelper::tDataSequenceCont & aSequencesToExport, + const SchXMLExportHelper_Impl::tDataSequenceCont & aSequencesToExport, const Reference< chart::XComplexDescriptionAccess >& xComplexDescriptionAccess, const OUString& rCategoriesRange, bool bSeriesFromColumns, @@ -641,10 +797,10 @@ lcl_TableData lcl_getDataForLocalTable( aResult.aComplexRowDescriptions = xComplexDescriptionAccess->getComplexRowDescriptions(); } - SchXMLExportHelper::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size(); - SchXMLExportHelper::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin()); - SchXMLExportHelper::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end()); - SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( aBegin ); + SchXMLExportHelper_Impl::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size(); + SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin()); + SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end()); + SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( aBegin ); size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport )); size_t nCategoriesLength( aSimpleCategories.getLength() ); @@ -832,7 +988,53 @@ struct SchXMLDataPointStruct // class SchXMLExportHelper // ======================================== -SchXMLExportHelper::SchXMLExportHelper( +SchXMLExportHelper::SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ) + : m_pImpl( new SchXMLExportHelper_Impl( rExport, rASPool ) ) +{ +} + +SchXMLExportHelper::~SchXMLExportHelper() +{ + delete m_pImpl; +} + +const OUString& SchXMLExportHelper::getChartCLSID() +{ + return m_pImpl->msCLSID; +} + +UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const +{ + return mxPropertySetMapper; +} + +void SchXMLExportHelper_Impl::exportAutoStyles() +{ + if( mxExpPropMapper.is()) + { + //ToDo: when embedded in calc/writer this is not necessary because the + // numberformatter is shared between both documents + mrExport.exportAutoDataStyles(); + + // export chart auto styles + mrAutoStylePool.exportXML( + XML_STYLE_FAMILY_SCH_CHART_ID + , mrExport.GetDocHandler(), + mrExport.GetMM100UnitConverter(), + mrExport.GetNamespaceMap() + ); + + // export auto styles for additional shapes + mrExport.GetShapeExport()->exportAutoStyles(); + // and for text in additional shapes + mrExport.GetTextParagraphExport()->exportTextAutoStyles(); + } +} + +// private methods +// --------------- + +SchXMLExportHelper_Impl::SchXMLExportHelper_Impl( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ) : mrExport( rExport ), @@ -901,56 +1103,22 @@ SchXMLExportHelper::SchXMLExportHelper( String( 'T' )); } -SchXMLExportHelper::~SchXMLExportHelper() {} - -const OUString& SchXMLExportHelper::getChartCLSID() -{ - return msCLSID; -} - -void SchXMLExportHelper::exportAutoStyles() +SchXMLExportHelper_Impl::~SchXMLExportHelper_Impl() { - if( mxExpPropMapper.is()) - { - //ToDo: when embedded in calc/writer this is not necessary because the - // numberformatter is shared between both documents - mrExport.exportAutoDataStyles(); - - // export chart auto styles - mrAutoStylePool.exportXML( - XML_STYLE_FAMILY_SCH_CHART_ID - , mrExport.GetDocHandler(), - mrExport.GetMM100UnitConverter(), - mrExport.GetNamespaceMap() - ); - - // export auto styles for additional shapes - mrExport.GetShapeExport()->exportAutoStyles(); - // and for text in additional shapes - mrExport.GetTextParagraphExport()->exportTextAutoStyles(); - } } -void SchXMLExportHelper::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc ) +void SchXMLExportHelper_Impl::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", "bm", "::SchXMLExportHelper::collectAutoStyles" ); - parseDocument( rChartDoc, sal_False ); } -void SchXMLExportHelper::exportChart( Reference< chart::XChartDocument > rChartDoc, +void SchXMLExportHelper_Impl::exportChart( Reference< chart::XChartDocument > rChartDoc, sal_Bool bIncludeTable ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", "bm", "::SchXMLExportHelper::exportChart" ); - parseDocument( rChartDoc, sal_True, bIncludeTable ); DBG_ASSERT( maAutoStyleNameQueue.empty(), "There are still remaining autostyle names in the queue" ); } - -// private methods -// --------------- - ::rtl::OUString lcl_GetStringFromNumberSequence( const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, bool bRemoveOneFromEachIndex /*should be true if having categories*/ ) { const sal_Int32* pArray = rSequenceMapping.getConstArray(); @@ -975,7 +1143,7 @@ void SchXMLExportHelper::exportChart( Reference< chart::XChartDocument > rChartD } /// if bExportContent is false the auto-styles are collected -void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rChartDoc, +void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& rChartDoc, sal_Bool bExportContent, sal_Bool bIncludeTable ) { @@ -1425,7 +1593,7 @@ void lcl_exportComplexLabel( const Sequence< OUString >& rComplexLabel, SvXMLExp } } -void SchXMLExportHelper::exportTable() +void SchXMLExportHelper_Impl::exportTable() { // table element // ------------- @@ -1602,7 +1770,7 @@ void SchXMLExportHelper::exportTable() OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) ); } -void SchXMLExportHelper::exportPlotArea( +void SchXMLExportHelper_Impl::exportPlotArea( Reference< chart::XDiagram > xDiagram, Reference< chart2::XDiagram > xNewDiagram, const awt::Size & rPageSize, @@ -1762,9 +1930,12 @@ void SchXMLExportHelper::exportPlotArea( } } - // element + // plot-area element pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, sal_True, sal_True ); + //inner position rectangle element + exportCoordinateRegion( xDiagram ); + // light sources (inside plot area element) if( bIs3DChart && rShapeExport.is()) @@ -1925,7 +2096,27 @@ void SchXMLExportHelper::exportPlotArea( delete pElPlotArea; } -void SchXMLExportHelper::exportAxes( +void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram ) +{ + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older + return; + if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST )//export only if extensions are enabled //#i100778# todo: change this dependent on fileformat evolution + return; + + Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY ); + DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" ); + if( !xDiaPos.is() ) + return; + + awt::Rectangle aRect( xDiaPos->calculateDiagramPositionExcludingAxes() ); + addPosition( awt::Point(aRect.X,aRect.Y) ); + addSize( awt::Size(aRect.Width,aRect.Height) ); + + SvXMLElementExport aCoordinateRegion( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//#i100778# todo: change to chart namespace in future - dependent on fileformat +} + +void SchXMLExportHelper_Impl::exportAxes( const Reference< chart::XDiagram > & xDiagram, const Reference< chart2::XDiagram > & xNewDiagram, sal_Bool bExportContent ) @@ -2527,7 +2718,7 @@ void SchXMLExportHelper::exportAxes( } } -void SchXMLExportHelper::exportSeries( +void SchXMLExportHelper_Impl::exportSeries( const Reference< chart2::XDiagram > & xNewDiagram, const awt::Size & rPageSize, sal_Bool bExportContent, @@ -2896,7 +3087,7 @@ void SchXMLExportHelper::exportSeries( } } -void SchXMLExportHelper::exportRegressionCurve( +void SchXMLExportHelper_Impl::exportRegressionCurve( const Reference< chart2::XDataSeries > & xSeries, const Reference< beans::XPropertySet > & xSeriesProp, const awt::Size & rPageSize, @@ -3003,7 +3194,7 @@ void SchXMLExportHelper::exportRegressionCurve( } } -void SchXMLExportHelper::exportCandleStickSeries( +void SchXMLExportHelper_Impl::exportCandleStickSeries( const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq, const Reference< chart2::XDiagram > & xDiagram, sal_Bool bJapaneseCandleSticks, @@ -3121,7 +3312,7 @@ void SchXMLExportHelper::exportCandleStickSeries( } } -void SchXMLExportHelper::exportDataPoints( +void SchXMLExportHelper_Impl::exportDataPoints( const uno::Reference< beans::XPropertySet > & xSeriesProperties, sal_Int32 nSeriesLength, const uno::Reference< chart2::XDiagram > & xDiagram, @@ -3369,7 +3560,7 @@ void SchXMLExportHelper::exportDataPoints( } -void SchXMLExportHelper::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) +void SchXMLExportHelper_Impl::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) { msStringBuffer.append( (sal_Unicode)'.' ); if( nCol < 26 ) @@ -3389,7 +3580,7 @@ void SchXMLExportHelper::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) msStringBuffer.append( nRow + (sal_Int32)1 ); } -void SchXMLExportHelper::addPosition( const awt::Point & rPosition ) +void SchXMLExportHelper_Impl::addPosition( const awt::Point & rPosition ) { mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.X ); msString = msStringBuffer.makeStringAndClear(); @@ -3400,13 +3591,13 @@ void SchXMLExportHelper::addPosition( const awt::Point & rPosition ) mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, msString ); } -void SchXMLExportHelper::addPosition( Reference< drawing::XShape > xShape ) +void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape ) { if( xShape.is()) addPosition( xShape->getPosition()); } -void SchXMLExportHelper::addSize( const awt::Size & rSize ) +void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize ) { mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width ); msString = msStringBuffer.makeStringAndClear(); @@ -3417,13 +3608,13 @@ void SchXMLExportHelper::addSize( const awt::Size & rSize ) mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, msString ); } -void SchXMLExportHelper::addSize( Reference< drawing::XShape > xShape ) +void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape ) { if( xShape.is()) addSize( xShape->getSize() ); } -awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const +awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const { awt::Size aSize( 8000, 7000 ); uno::Reference< embed::XVisualObject > xVisualObject( xChartDoc, uno::UNO_QUERY ); @@ -3434,13 +3625,13 @@ awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocume return aSize; } -void SchXMLExportHelper::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates ) +void SchXMLExportHelper_Impl::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XML_STYLE_FAMILY_SCH_CHART_ID, aStates )); } -void SchXMLExportHelper::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ) +void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) { @@ -3451,7 +3642,7 @@ void SchXMLExportHelper::AddAutoStyleAttribute( const std::vector< XMLPropertySt } } -void SchXMLExportHelper::exportText( const OUString& rText, bool bConvertTabsLFs ) +void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTabsLFs ) { SchXMLTools::exportText( mrExport, rText, bConvertTabsLFs ); } @@ -3468,6 +3659,8 @@ SchXMLExport::SchXMLExport( maAutoStylePool( *this ), maExportHelper( *this, maAutoStylePool ) { + if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); } @@ -3484,7 +3677,7 @@ SchXMLExport::~SchXMLExport() sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); - maExportHelper.InitRangeSegmentationProperties( xChartDoc ); + maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc ); return SvXMLExport::exportDoc( eClass ); } @@ -3507,8 +3700,8 @@ void SchXMLExport::_ExportAutoStyles() Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); if( xChartDoc.is()) { - maExportHelper.collectAutoStyles( xChartDoc ); - maExportHelper.exportAutoStyles(); + maExportHelper.m_pImpl->collectAutoStyles( xChartDoc ); + maExportHelper.m_pImpl->exportAutoStyles(); } else { @@ -3557,13 +3750,13 @@ void SchXMLExport::_ExportContent() aAny = xProp->getPropertyValue( OUString::createFromAscii( "ChartRangeAddress" )); aAny >>= sChartAddress; - maExportHelper.SetChartRangeAddress( sChartAddress ); + maExportHelper.m_pImpl->SetChartRangeAddress( sChartAddress ); OUString sTableNumberList; aAny = xProp->getPropertyValue( OUString::createFromAscii( "TableNumberList" )); aAny >>= sTableNumberList; - maExportHelper.SetTableNumberList( sTableNumberList ); + maExportHelper.m_pImpl->SetTableNumberList( sTableNumberList ); // do not include own table if there are external addresses bIncludeTable = (sChartAddress.getLength() == 0); @@ -3576,7 +3769,7 @@ void SchXMLExport::_ExportContent() } } } - maExportHelper.exportChart( xChartDoc, bIncludeTable ); + maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable ); } else { @@ -3591,7 +3784,12 @@ void SchXMLExport::SetProgress( sal_Int32 nPercentage ) mxStatusIndicator->setValue( nPercentage ); } -void SchXMLExportHelper::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc ) +UniReference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const +{ + return maExportHelper.m_pImpl->GetPropertySetMapper(); +} + +void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc ) { if( xChartDoc.is()) try diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 6afbaecb551c..587070202c9c 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -281,6 +281,8 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] = { + { XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION_EXT }, + { XML_NAMESPACE_CHART, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION }, { XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS }, { XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES }, { XML_NAMESPACE_CHART, XML_WALL, XML_TOK_PA_WALL }, @@ -657,6 +659,7 @@ SchXMLImport::SchXMLImport( SvXMLImport( xServiceFactory, nImportFlags ) { GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); mbIsGraphicLoadOnDemandSupported = false; } @@ -670,6 +673,7 @@ SchXMLImport::SchXMLImport( : SvXMLImport( xServiceFactory, xModel, rGrfContainer ) { GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); // get status indicator (if requested) if( bShowProgress ) diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index ec5c4b2130c1..61dab1fb52cb 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -199,8 +200,8 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( mnSeries( 0 ), m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ), maSceneImportHelper( rImport ), - mbHasSize(false), - mbHasPosition(false), + m_aOuterPositioning( rImport ), + m_aInnerPositioning( rImport ), mbPercentStacked(false), m_bAxisPositionAttributeImported(false), m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider), @@ -296,15 +297,6 @@ SchXMLPlotAreaContext::~SchXMLPlotAreaContext() void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { - uno::Any aTransMatrixAny; - - // initialize size and position - uno::Reference< drawing::XShape > xDiaShape( mxDiagram, uno::UNO_QUERY ); - bool bHasSizeWidth = false; - bool bHasSizeHeight = false; - bool bHasPositionX = false; - bool bHasPositionY = false; - // parse attributes sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetPlotAreaAttrTokenMap(); @@ -320,20 +312,10 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri switch( rAttrTokenMap.Get( nPrefix, aLocalName )) { case XML_TOK_PA_X: - GetImport().GetMM100UnitConverter().convertMeasure( maPosition.X, aValue ); - bHasPositionX = true; - break; case XML_TOK_PA_Y: - GetImport().GetMM100UnitConverter().convertMeasure( maPosition.Y, aValue ); - bHasPositionY = true; - break; case XML_TOK_PA_WIDTH: - GetImport().GetMM100UnitConverter().convertMeasure( maSize.Width, aValue ); - bHasSizeWidth = true; - break; case XML_TOK_PA_HEIGHT: - GetImport().GetMM100UnitConverter().convertMeasure( maSize.Height, aValue ); - bHasSizeHeight = true; + m_aOuterPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue ); break; case XML_TOK_PA_STYLE_NAME: msAutoStyleName = aValue; @@ -369,9 +351,6 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri } } - mbHasSize = bHasSizeWidth && bHasSizeHeight; - mbHasPosition = bHasPositionX && bHasPositionY; - if( ! mxNewDoc.is()) { uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY ); @@ -426,14 +405,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lines")), pPropStyleContext, pStylesCtxt ); //handle automatic position and size - bool bAutoSize = false; - bool bAutoPosition = false; - SchXMLTools::getPropertyFromContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= bAutoSize; - SchXMLTools::getPropertyFromContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= bAutoPosition; - mbHasSize = mbHasSize && !bAutoSize; - mbHasPosition = mbHasPosition && !bAutoPosition; + m_aOuterPositioning.readAutomaticPositioningProperties( pPropStyleContext, pStylesCtxt ); //correct default starting angle for old 3D pies if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_0( GetImport().GetModel() ) ) @@ -548,6 +520,13 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( switch( rTokenMap.Get( nPrefix, rLocalName )) { + case XML_TOK_PA_COORDINATE_REGION_EXT: + case XML_TOK_PA_COORDINATE_REGION: + { + pContext = new SchXMLCoordinateRegionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); + } + break; + case XML_TOK_PA_AXIS: { bool bAddMissingXAxisForNetCharts = false; @@ -711,13 +690,22 @@ void SchXMLPlotAreaContext::EndElement() } // set changed size and position after properties (esp. 3d) - uno::Reference< drawing::XShape > xDiaShape( mxDiagram, uno::UNO_QUERY ); - if( xDiaShape.is()) + + uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY ); + if( xDiaPos.is()) { - if( mbHasSize ) - xDiaShape->setSize( maSize ); - if( mbHasPosition ) - xDiaShape->setPosition( maPosition ); + if( !m_aOuterPositioning.isAutomatic() ) + { + if( m_aInnerPositioning.hasPosSize() ) + xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() ); + else if( m_aOuterPositioning.hasPosSize() ) + { + if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size + xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() ); + else + xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() ); + } + } } CorrectAxisPositions(); @@ -1681,6 +1669,134 @@ void SchXMLCategoriesContext::StartElement( const uno::Reference< xml::sax::XAtt // ======================================== +SchXMLPositonAttributesHelper::SchXMLPositonAttributesHelper( SvXMLImport& rImporter ) + : m_rImport( rImporter ) + , m_aPosition(0,0) + , m_aSize(0,0) + , m_bHasSizeWidth( false ) + , m_bHasSizeHeight( false ) + , m_bHasPositionX( false ) + , m_bHasPositionY( false ) + , m_bAutoSize( false ) + , m_bAutoPosition( false ) +{ +} + +SchXMLPositonAttributesHelper::~SchXMLPositonAttributesHelper() +{ +} + +bool SchXMLPositonAttributesHelper::hasSize() const +{ + return m_bHasSizeWidth && m_bHasSizeHeight; +} +bool SchXMLPositonAttributesHelper::hasPosition() const +{ + return m_bHasPositionX && m_bHasPositionY; +} +bool SchXMLPositonAttributesHelper::hasPosSize() const +{ + return hasPosition() && hasSize(); +} +bool SchXMLPositonAttributesHelper::isAutomatic() const +{ + return m_bAutoSize || m_bAutoPosition; +} +awt::Point SchXMLPositonAttributesHelper::getPosition() const +{ + return m_aPosition; +} +awt::Size SchXMLPositonAttributesHelper::getSize() const +{ + return m_aSize; +} +awt::Rectangle SchXMLPositonAttributesHelper::getRectangle() const +{ + return awt::Rectangle( m_aPosition.X, m_aPosition.Y, m_aSize.Width, m_aSize.Height ); +} + +bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + //returns true if the attribute was proccessed + bool bReturn = true; + + if( XML_NAMESPACE_SVG == nPrefix ) + { + if( IsXMLToken( rLocalName, XML_X ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.X, rValue ); + m_bHasPositionX = true; + } + else if( IsXMLToken( rLocalName, XML_Y ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.Y, rValue ); + m_bHasPositionY = true; + } + else if( IsXMLToken( rLocalName, XML_WIDTH ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Width, rValue ); + m_bHasSizeWidth = true; + } + else if( IsXMLToken( rLocalName, XML_HEIGHT ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Height, rValue ); + m_bHasSizeHeight = true; + } + else + bReturn = false; + } + else + bReturn = false; + + return bReturn; +} + + +void SchXMLPositonAttributesHelper::readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ) +{ + if( pPropStyleContext && pStylesCtxt ) + { + //handle automatic position and size + SchXMLTools::getPropertyFromContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoSize; + SchXMLTools::getPropertyFromContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoPosition; + } +} + +// ======================================== + +SchXMLCoordinateRegionContext::SchXMLCoordinateRegionContext( + SvXMLImport& rImport + , sal_uInt16 nPrefix + , const rtl::OUString& rLocalName + , SchXMLPositonAttributesHelper& rPositioning ) + : SvXMLImportContext( rImport, nPrefix, rLocalName ) + , m_rPositioning( rPositioning ) +{ +} + +SchXMLCoordinateRegionContext::~SchXMLCoordinateRegionContext() +{ +} + +void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +{ + // parse attributes + sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; + + for( sal_Int16 i = 0; i < nAttrCount; i++ ) + { + rtl::OUString sAttrName = xAttrList->getNameByIndex( i ); + rtl::OUString aLocalName; + rtl::OUString aValue = xAttrList->getValueByIndex( i ); + USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); + m_rPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue ); + } +} + +// ======================================== + SchXMLWallFloorContext::SchXMLWallFloorContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx index 56aa3e78c814..1f0de466dcb1 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -66,6 +66,43 @@ private: SchXML3DSceneAttributesHelper(); }; +// ---------------------------------------- + +class SchXMLPositonAttributesHelper +{ +public: + SchXMLPositonAttributesHelper( SvXMLImport& rImporter ); + ~SchXMLPositonAttributesHelper(); + + bool readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); + void readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ); + + bool hasPosSize() const; + bool isAutomatic() const; + ::com::sun::star::awt::Rectangle getRectangle() const; + + +private: + bool hasSize() const; + bool hasPosition() const; + ::com::sun::star::awt::Size getSize() const; + ::com::sun::star::awt::Point getPosition() const; + + SvXMLImport& m_rImport; + + ::com::sun::star::awt::Point m_aPosition; + ::com::sun::star::awt::Size m_aSize; + + bool m_bHasSizeWidth; + bool m_bHasSizeHeight; + bool m_bHasPositionX; + bool m_bHasPositionY; + sal_Bool m_bAutoSize; + sal_Bool m_bAutoPosition; +}; + +// ---------------------------------------- + class SchXMLPlotAreaContext : public SvXMLImportContext { public: @@ -110,10 +147,8 @@ private: GlobalSeriesImportInfo m_aGlobalSeriesImportInfo; SchXML3DSceneAttributesHelper maSceneImportHelper; - ::com::sun::star::awt::Size maSize; - ::com::sun::star::awt::Point maPosition; - bool mbHasSize; - bool mbHasPosition; + SchXMLPositonAttributesHelper m_aOuterPositioning;//including axes and axes titles + SchXMLPositonAttributesHelper m_aInnerPositioning;//excluding axes and axes titles bool mbPercentStacked; bool m_bAxisPositionAttributeImported; ::rtl::OUString msAutoStyleName; @@ -216,6 +251,23 @@ public: // ---------------------------------------- +class SchXMLCoordinateRegionContext : public SvXMLImportContext +{ +public: + SchXMLCoordinateRegionContext( + SvXMLImport& rImport + , sal_uInt16 nPrefix + , const rtl::OUString& rLocalName + , SchXMLPositonAttributesHelper& rPositioning ); + virtual ~SchXMLCoordinateRegionContext(); + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + +private: + SchXMLPositonAttributesHelper& m_rPositioning; +}; + +// ---------------------------------------- + class SchXMLWallFloorContext : public SvXMLImportContext { public: diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 32fe36197a32..582e5aead326 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -757,6 +757,29 @@ void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo ); } +bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel ) +{ + bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel ); + if( !bResult ) + { + ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) ); + if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/3") ) ) != -1 ) + { + if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/300m") ) ) != -1 ) + { + sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) ); + if( nBuilId>0 && nBuilId<9491 ) //9491 is build id of dev300m76 + bResult= true; + } + else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/310m") ) ) != -1 ) + bResult= true; + else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 ) + bResult= true; + } + } + return bResult; +} + bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel ) { bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel ); diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index 0b77d8e6d38a..bcc39ae3d114 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -54,6 +54,7 @@ namespace SchXMLTools bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); + bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo ); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 9b2fb9eea891..2af9966bc351 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3096,6 +3096,10 @@ namespace xmloff { namespace token { TOKEN( "ends-with", XML_ENDS_WITH ), TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ), + TOKEN( "chartooo", XML_NP_CHART_EXT ), + TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ), + TOKEN( "coordinate-region", XML_COORDINATE_REGION ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index 21097108ca29..d13b5e24e2db 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -31,7 +31,6 @@ #include <com/sun/star/text/XText.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/drawing/CircleKind.hpp> #include <com/sun/star/drawing/ConnectorType.hpp> #include <com/sun/star/drawing/XControlShape.hpp> @@ -1247,27 +1246,6 @@ void XMLShapeExport::ImpExportChartShape( SvXMLAttributeList* pAttrList ) { ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList ); -/* - // Transformation - ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); - - uno::Reference< chart::XChartDocument > xChartDoc; - if( !bIsEmptyPresObj ) - xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xChartDoc; - - if( xChartDoc.is() ) - { - // export chart data if the flag is not set (default) - sal_Bool bExportOwnData = ( nFeatures & SEF_EXPORT_NO_CHART_DATA ) == 0; - mrExport.GetChartExport()->exportChart( xChartDoc, bExportOwnData ); - } - else - { - // write chart object (fake for now, replace later) - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_CHART, XML_CHART, sal_True, sal_True); - } - } -*/ } ////////////////////////////////////////////////////////////////////////////// diff --git a/xmloff/source/forms/valueproperties.cxx b/xmloff/source/forms/valueproperties.cxx index 3515dcf96010..1c44db963944 100644 --- a/xmloff/source/forms/valueproperties.cxx +++ b/xmloff/source/forms/valueproperties.cxx @@ -116,7 +116,7 @@ namespace xmloff void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType, sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName) { - _rpMinValuePropertyName = _rpMinValuePropertyName = NULL; + _rpMinValuePropertyName = _rpMaxValuePropertyName = NULL; switch (_nFormComponentType) { case FormComponentType::DATEFIELD: |