sw/inc/tblafmt.hxx | 32 +- sw/qa/core/uwriter.cxx | 144 ++++++------ sw/qa/extras/uiwriter/uiwriter4.cxx | 16 - sw/source/core/doc/doc.cxx | 8 sw/source/core/doc/tblafmt.cxx | 102 ++++---- sw/source/core/unocore/unostyle.cxx | 371 +++++++++++++++---------------- sw/source/ui/table/autoformatpreview.cxx | 12 - 7 files changed, 350 insertions(+), 335 deletions(-)
New commits: commit 45e1f8ea87f7bf3d540b707b4e5c8bfdcaa36bb3 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri May 30 20:01:12 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Jun 2 22:54:44 2025 +0200 split SwBoxAutoFormat into SwBoxAutoFormat and SwAutoFormatProps and make SwBoxAutoFormat own a SwAutoFormatProps. Leaving the generally mutable m_xAutoFormatUnoObject in SwBoxAutoFormat Change-Id: I3595d92aeb7f058de3a755633eebacc63fe6a9a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186064 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 8f0b64d1f8dd..0af6a1f15792 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -46,7 +46,7 @@ class SwTable; class SwXTextCellStyle; class SwXTextTableStyle; -class SW_DLLPUBLIC SwBoxAutoFormat : public AutoFormatBase +class SW_DLLPUBLIC SwAutoFormatProps : public AutoFormatBase { private: // Writer specific @@ -58,19 +58,16 @@ private: LanguageType m_eSysLanguage; LanguageType m_eNumFormatLanguage; - // associated UNO object, if such exists - unotools::WeakReference<SwXTextCellStyle> m_xAutoFormatUnoObject; - public: - SwBoxAutoFormat(); - SwBoxAutoFormat( const SwBoxAutoFormat& rNew ); - ~SwBoxAutoFormat(); + SwAutoFormatProps(); + SwAutoFormatProps(const SwAutoFormatProps& rNew); + ~SwAutoFormatProps(); /// assignment-op (still used) - SwBoxAutoFormat& operator=(const SwBoxAutoFormat& rRef); + SwAutoFormatProps& operator=(const SwAutoFormatProps& rRef); /// Comparing based of boxes backgrounds. - bool operator==(const SwBoxAutoFormat& rRight) const; + bool operator==(const SwAutoFormatProps& rRight) const; // The get-methods. const SvxFrameDirectionItem& GetTextOrientation() const { return *m_aTextOrientation; } @@ -94,12 +91,25 @@ public: void SetSysLanguage(const LanguageType& rNew) { m_eSysLanguage = rNew; } void SetNumFormatLanguage(const LanguageType& rNew) { m_eNumFormatLanguage = rNew; } + bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ); + bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; +}; + +class SW_DLLPUBLIC SwBoxAutoFormat +{ +private: + SwAutoFormatProps m_aAutoFormat; + + // associated UNO object, if such exists + unotools::WeakReference<SwXTextCellStyle> m_xAutoFormatUnoObject; + +public: unotools::WeakReference<SwXTextCellStyle> const& GetXObject() const { return m_xAutoFormatUnoObject; } void SetXObject(rtl::Reference<SwXTextCellStyle> const& xObject); - bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ); - bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; + const SwAutoFormatProps& GetProps() const { return m_aAutoFormat; } + SwAutoFormatProps& GetProps() { return m_aAutoFormat; } }; enum class SwTableAutoFormatUpdateFlags { Char = 1, Box = 2 }; diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 8314aec68fc7..ec4c21f03b24 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1077,122 +1077,123 @@ void SwDocTest::testTableAutoFormats() //create new AutoFormat SwBoxAutoFormat aBoxAF; + SwAutoFormatProps& rBoxFP = aBoxAF.GetProps(); //SetFont SvxFontItem aFont( RES_CHRATR_FONT ); aFont.SetFamily( FontFamily::FAMILY_DECORATIVE ); aFont.SetPitch( FontPitch::PITCH_VARIABLE ); aFont.SetCharSet( RTL_TEXTENCODING_MS_1251 ); - aBoxAF.SetFont( aFont ); + rBoxFP.SetFont( aFont ); //SetHeight SvxFontHeightItem aHeight( 280, 120, RES_CHRATR_FONTSIZE ); - aBoxAF.SetHeight( aHeight ); + rBoxFP.SetHeight( aHeight ); //SetWeight SvxWeightItem aWeight( FontWeight::WEIGHT_BOLD, RES_CHRATR_WEIGHT ); - aBoxAF.SetWeight( aWeight ); + rBoxFP.SetWeight( aWeight ); //SetPosture SvxPostureItem aPosture( FontItalic::ITALIC_NORMAL, RES_CHRATR_POSTURE ); - aBoxAF.SetPosture( aPosture ); + rBoxFP.SetPosture( aPosture ); //SetCJKFont SvxFontItem aCJKFont( RES_CHRATR_FONT ); aCJKFont.SetFamily( FontFamily::FAMILY_MODERN ); aCJKFont.SetPitch( FontPitch::PITCH_FIXED ); aCJKFont.SetCharSet( RTL_TEXTENCODING_MS_1251 ); - aBoxAF.SetCJKFont( aCJKFont ); + rBoxFP.SetCJKFont( aCJKFont ); //SetCJKHeight SvxFontHeightItem aCJKHeight( 230, 110, RES_CHRATR_FONTSIZE ); - aBoxAF.SetCJKHeight( aCJKHeight ); + rBoxFP.SetCJKHeight( aCJKHeight ); //SetCJKWeight SvxWeightItem aCJKWeight( FontWeight::WEIGHT_SEMIBOLD, RES_CHRATR_WEIGHT ); - aBoxAF.SetCJKWeight( aCJKWeight ); + rBoxFP.SetCJKWeight( aCJKWeight ); //SetCJKPosture SvxPostureItem aCJKPosture( FontItalic::ITALIC_OBLIQUE, RES_CHRATR_POSTURE ); - aBoxAF.SetCJKPosture( aCJKPosture ); + rBoxFP.SetCJKPosture( aCJKPosture ); //SetCTLFont SvxFontItem aCTLFont( RES_CHRATR_FONT ); aCTLFont.SetFamily( FontFamily::FAMILY_ROMAN ); aCTLFont.SetPitch( FontPitch::PITCH_FIXED ); aCTLFont.SetCharSet( RTL_TEXTENCODING_MS_1251 ); - aBoxAF.SetCTLFont( aCTLFont ); + rBoxFP.SetCTLFont( aCTLFont ); //SetCTLHeight SvxFontHeightItem aCTLHeight( 215, 105, RES_CHRATR_FONTSIZE ); - aBoxAF.SetCTLHeight( aCTLHeight ); + rBoxFP.SetCTLHeight( aCTLHeight ); //SetCTLWeight SvxWeightItem aCTLWeight( FontWeight::WEIGHT_ULTRABOLD, RES_CHRATR_WEIGHT ); - aBoxAF.SetCTLWeight( aCTLWeight ); + rBoxFP.SetCTLWeight( aCTLWeight ); //SetCTLPosture SvxPostureItem aCTLPosture( FontItalic::ITALIC_OBLIQUE, RES_CHRATR_POSTURE ); - aBoxAF.SetCTLPosture( aCTLPosture ); + rBoxFP.SetCTLPosture( aCTLPosture ); //SetUnderline SvxUnderlineItem aUnderline( FontLineStyle::LINESTYLE_DOTTED, RES_CHRATR_UNDERLINE ); - aBoxAF.SetUnderline( aUnderline ); + rBoxFP.SetUnderline( aUnderline ); //SetOverline SvxOverlineItem aOverline( FontLineStyle::LINESTYLE_DASH, RES_CHRATR_OVERLINE ); - aBoxAF.SetOverline( aOverline ); + rBoxFP.SetOverline( aOverline ); //SetCrossedOut SvxCrossedOutItem aCrossedOut( FontStrikeout::STRIKEOUT_BOLD, RES_CHRATR_CROSSEDOUT ); - aBoxAF.SetCrossedOut( aCrossedOut ); + rBoxFP.SetCrossedOut( aCrossedOut ); //SetContour SvxContourItem aContour( true, RES_CHRATR_CONTOUR ); - aBoxAF.SetContour( aContour ); + rBoxFP.SetContour( aContour ); //SetShadowed SvxShadowedItem aShadowed( false, RES_CHRATR_SHADOWED ); - aBoxAF.SetShadowed( aShadowed ); + rBoxFP.SetShadowed( aShadowed ); //SetColor SvxColorItem aColor( Color(0xFF23FF), RES_CHRATR_COLOR ); - aBoxAF.SetColor( aColor ); + rBoxFP.SetColor( aColor ); //SetAdjust SvxAdjustItem aAdjust( SvxAdjust::Center, RES_PARATR_ADJUST ); - aBoxAF.SetAdjust( aAdjust ); + rBoxFP.SetAdjust( aAdjust ); //SetTextOrientation SvxFrameDirectionItem aTOrientation( SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR ); - aBoxAF.SetTextOrientation( aTOrientation ); + rBoxFP.SetTextOrientation( aTOrientation ); //SetVerticalAlignment SwFormatVertOrient aVAlignment( 3, css::text::VertOrientation::CENTER, css::text::RelOrientation::PAGE_LEFT ); - aBoxAF.SetVerticalAlignment( aVAlignment ); + rBoxFP.SetVerticalAlignment( aVAlignment ); //SetBox SvxBoxItem aBox( RES_BOX ); aBox.SetAllDistances( 5 ); - aBoxAF.SetBox( aBox ); + rBoxFP.SetBox( aBox ); //SetBackground SvxBrushItem aBackground( Color(0xFF11FF), RES_BACKGROUND ); - aBoxAF.SetBackground( aBackground ); + rBoxFP.SetBackground( aBackground ); //Set m_aTLBR SvxLineItem aTLBRLine(0); aTLBRLine.ScaleMetrics( 11,12 ); - aBoxAF.SetTLBR(aTLBRLine); + rBoxFP.SetTLBR(aTLBRLine); //Set m_aBLTR SvxLineItem aBLTRLine(0); aBLTRLine.ScaleMetrics( 13,14 ); - aBoxAF.SetBLTR(aBLTRLine); + rBoxFP.SetBLTR(aBLTRLine); //Set m_aHorJustify SvxHorJustifyItem aHJustify( SvxCellHorJustify::Center, 0 ); - aBoxAF.SetHorJustify(aHJustify); + rBoxFP.SetHorJustify(aHJustify); //Set m_aVerJustify SvxVerJustifyItem aVJustify( SvxCellVerJustify::Center , 0 ); - aBoxAF.SetVerJustify(aVJustify); + rBoxFP.SetVerJustify(aVJustify); //Set m_aStacked SfxBoolItem aStacked(0, true); - aBoxAF.SetStacked(aStacked); + rBoxFP.SetStacked(aStacked); //Set m_aMargin SvxMarginItem aSvxMarginItem(sal_Int16(4), sal_Int16(2), sal_Int16(3), sal_Int16(3), TypedWhichId<SvxMarginItem>(0)); - aBoxAF.SetMargin(aSvxMarginItem); + rBoxFP.SetMargin(aSvxMarginItem); //Set m_aLinebreak SfxBoolItem aLBreak(0, true); - aBoxAF.SetLinebreak(aLBreak); + rBoxFP.SetLinebreak(aLBreak); //Set m_aRotateAngle SfxInt32Item aRAngle(sal_Int32(5)); - aBoxAF.SetRotateAngle(aRAngle); + rBoxFP.SetRotateAngle(aRAngle); //Set m_aRotateMode SvxRotateModeItem aSvxRotateModeItem(SVX_ROTATE_MODE_CENTER, TypedWhichId<SvxRotateModeItem>(0)); - aBoxAF.SetRotateMode(aSvxRotateModeItem); + rBoxFP.SetRotateMode(aSvxRotateModeItem); //Set m_sNumFormatString OUString aNFString = u"UnitTestFormat"_ustr; - aBoxAF.SetNumFormatString(aNFString); + rBoxFP.SetNumFormatString(aNFString); //Set m_eSysLanguage LanguageType aSLang( LANGUAGE_ENGLISH_INDIA ); - aBoxAF.SetSysLanguage(aSLang); + rBoxFP.SetSysLanguage(aSLang); //Set m_eNumFormatLanguage LanguageType aNFLang( LANGUAGE_GERMAN ); - aBoxAF.SetNumFormatLanguage(aNFLang); + rBoxFP.SetNumFormatLanguage(aNFLang); //Set m_aKeepWithNextPara SvxFormatKeepItem aKWNPara( true, 0 ); aTableAF.SetKeepWithNextPara(aKWNPara); @@ -1250,77 +1251,78 @@ void SwDocTest::testTableAutoFormats() //assert the values SwTableAutoFormat* pLoadAF = aLoadTAFT.FindAutoFormat( TableStyleName(u"TestItemStyle"_ustr) ); CPPUNIT_ASSERT( pLoadAF ); + const SwAutoFormatProps& rLoadFP = pLoadAF->GetBoxFormat(0).GetProps(); //GetFont - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetFont() == aFont ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetFont() == aFont ) ); //GetHeight - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetHeight() == aHeight ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetHeight() == aHeight ) ); //GetWeight - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetWeight() == aWeight ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetWeight() == aWeight ) ); //GetPosture - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetPosture() == aPosture ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetPosture() == aPosture ) ); //GetCJKFont - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCJKFont() == aCJKFont ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCJKFont() == aCJKFont ) ); //GetCJKHeight - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCJKHeight() == aCJKHeight ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCJKHeight() == aCJKHeight ) ); //GetCJKWeight - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCJKWeight() == aCJKWeight ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCJKWeight() == aCJKWeight ) ); //GetCJKPosture - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCJKPosture() == aCJKPosture ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCJKPosture() == aCJKPosture ) ); //GetCTLFont - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCTLFont() == aCTLFont ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCTLFont() == aCTLFont ) ); //GetCTLHeight - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCTLHeight() == aCTLHeight ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCTLHeight() == aCTLHeight ) ); //GetCTLWeight - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCTLWeight() == aCTLWeight ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCTLWeight() == aCTLWeight ) ); //GetCTLPosture - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCTLPosture() == aCTLPosture ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCTLPosture() == aCTLPosture ) ); //GetUnderline - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetUnderline() == aUnderline ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetUnderline() == aUnderline ) ); //GetOverline - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetOverline() == aOverline ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetOverline() == aOverline ) ); //GetCrossedOut - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetCrossedOut() == aCrossedOut ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetCrossedOut() == aCrossedOut ) ); //GetContour - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetContour() == aContour ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetContour() == aContour ) ); //GetShadowed - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetShadowed() == aShadowed ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetShadowed() == aShadowed ) ); //GetColor - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetColor() == aColor) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetColor() == aColor) ); //GetAdjust - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetAdjust() == aAdjust ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetAdjust() == aAdjust ) ); //GetTextOrientation - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetTextOrientation() == aTOrientation ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetTextOrientation() == aTOrientation ) ); //GetVerticalAlignment - CPPUNIT_ASSERT (bool( pLoadAF->GetBoxFormat(0).GetVerticalAlignment() == aVAlignment ) ); + CPPUNIT_ASSERT (bool( rLoadFP.GetVerticalAlignment() == aVAlignment ) ); //GetBox - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBox() == aBox ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetBox() == aBox ) ); //GetBackground - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBackground() == aBackground ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetBackground() == aBackground ) ); //Get m_aTLBR - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetTLBR() == aTLBRLine ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetTLBR() == aTLBRLine ) ); //Get m_aBLTR - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBLTR() == aBLTRLine ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetBLTR() == aBLTRLine ) ); //Get m_aHorJustify - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetHorJustify() == aHJustify ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetHorJustify() == aHJustify ) ); //Get m_aVerJustify - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetVerJustify() == aVJustify ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetVerJustify() == aVJustify ) ); //Get m_aStacked - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetStacked() == aStacked ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetStacked() == aStacked ) ); //Get m_aMargin - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetMargin() == aSvxMarginItem ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetMargin() == aSvxMarginItem ) ); //Get m_aLinebreak - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetLinebreak() == aLBreak ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetLinebreak() == aLBreak ) ); //Get m_aRotateAngle - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetRotateAngle() == aRAngle ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetRotateAngle() == aRAngle ) ); //Get m_aRotateMode - //SvxRotateModeItem aRMode = aBoxAF.m_aRotateMode;GetRotateMode - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetRotateMode() == aSvxRotateModeItem ) ); + //SvxRotateModeItem aRMode = rBoxFP.m_aRotateMode;GetRotateMode + CPPUNIT_ASSERT( bool( rLoadFP.GetRotateMode() == aSvxRotateModeItem ) ); //Get m_sNumFormatString - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetNumFormatString() == aNFString ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetNumFormatString() == aNFString ) ); //Get m_eSysLanguage - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetSysLanguage() == aSLang ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetSysLanguage() == aSLang ) ); //Get m_eNumFormatLanguage - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetNumFormatLanguage() == aNFLang ) ); + CPPUNIT_ASSERT( bool( rLoadFP.GetNumFormatLanguage() == aNFLang ) ); //Get m_aKeepWithNextPara CPPUNIT_ASSERT( bool( pLoadAF->GetKeepWithNextPara() == aKWNPara ) ); //Get m_aRepeatHeading diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 54dd007624f3..706529715e52 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -1126,7 +1126,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableStyleUndo) sal_Int32 nStyleCount = pDoc->GetTableStyles().size(); SwTableAutoFormat* pStyle = pDoc->MakeTableStyle(TableStyleName(u"Test Style"_ustr)); SvxBrushItem aBackground(COL_LIGHTMAGENTA, RES_BACKGROUND); - pStyle->GetBoxFormat(0).SetBackground(aBackground); + pStyle->GetBoxFormat(0).GetProps().SetBackground(aBackground); CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount + 1); rUndoManager.Undo(); @@ -1136,7 +1136,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableStyleUndo) // check if attributes are preserved pStyle = pDoc->GetTableStyles().FindAutoFormat(TableStyleName(u"Test Style"_ustr)); CPPUNIT_ASSERT(pStyle); - CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground)); + CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetProps().GetBackground() == aBackground)); pDoc->DelTableStyle(TableStyleName(u"Test Style"_ustr)); CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount); @@ -1145,7 +1145,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableStyleUndo) pStyle = pDoc->GetTableStyles().FindAutoFormat(TableStyleName(u"Test Style"_ustr)); // check if attributes are preserved CPPUNIT_ASSERT(pStyle); - CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground)); + CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetProps().GetBackground() == aBackground)); rUndoManager.Redo(); CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount); @@ -1154,24 +1154,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableStyleUndo) CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount + 1); pStyle = pDoc->GetTableStyles().FindAutoFormat(TableStyleName(u"Test Style"_ustr)); CPPUNIT_ASSERT(pStyle); - CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground)); + CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetProps().GetBackground() == aBackground)); SwTableAutoFormat aNewStyle(TableStyleName(u"Test Style2"_ustr)); SvxBrushItem aBackground2(COL_LIGHTGREEN, RES_BACKGROUND); - aNewStyle.GetBoxFormat(0).SetBackground(aBackground2); + aNewStyle.GetBoxFormat(0).GetProps().SetBackground(aBackground2); pDoc->ChgTableStyle(TableStyleName(u"Test Style"_ustr), aNewStyle); pStyle = pDoc->GetTableStyles().FindAutoFormat(TableStyleName(u"Test Style"_ustr)); CPPUNIT_ASSERT(pStyle); - CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground2)); + CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetProps().GetBackground() == aBackground2)); rUndoManager.Undo(); pStyle = pDoc->GetTableStyles().FindAutoFormat(TableStyleName(u"Test Style"_ustr)); CPPUNIT_ASSERT(pStyle); - CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground)); + CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetProps().GetBackground() == aBackground)); rUndoManager.Redo(); pStyle = pDoc->GetTableStyles().FindAutoFormat(TableStyleName(u"Test Style"_ustr)); CPPUNIT_ASSERT(pStyle); - CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetBackground() == aBackground2)); + CPPUNIT_ASSERT(bool(pStyle->GetBoxFormat(0).GetProps().GetBackground() == aBackground2)); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineCopyPaste) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 03794f311cec..7d5a2f95322c 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1261,8 +1261,8 @@ void SwDoc::ForEachOverlineItem( const std::function<bool(const SvxOverlineItem& const SwTableAutoFormat& rTableStyle = rTableStyles[i]; for (const sal_uInt32 nBoxIndex : aTableTemplateMap) { - const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex); - const SvxOverlineItem rOverlineItem = rBoxFormat.GetOverline(); + const SwAutoFormatProps& rBoxProps = rTableStyle.GetBoxFormat(nBoxIndex).GetProps(); + const SvxOverlineItem rOverlineItem = rBoxProps.GetOverline(); if (!rFunc(rOverlineItem)) return; } @@ -1271,8 +1271,8 @@ void SwDoc::ForEachOverlineItem( const std::function<bool(const SvxOverlineItem& for (size_t i=0; i < rCellStyleTable.size(); ++i) { const SwCellStyleDescriptor aCellStyle = rCellStyleTable[i]; - const SwBoxAutoFormat& rBoxFormat = aCellStyle.GetAutoFormat(); - const SvxOverlineItem rOverlineItem = rBoxFormat.GetOverline(); + const SwAutoFormatProps& rBoxProps = aCellStyle.GetAutoFormat().GetProps(); + const SvxOverlineItem rOverlineItem = rBoxProps.GetOverline(); if (!rFunc(rOverlineItem)) return; } diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 897526c75a93..0529a04d5356 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -217,9 +217,7 @@ void SwAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion) AutoFormatVersions::WriteBlockB(rStream, fileVersion); } - - -SwBoxAutoFormat::SwBoxAutoFormat() +SwAutoFormatProps::SwAutoFormatProps() : m_aTextOrientation(std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)), m_aVerticalAlignment(std::make_unique<SwFormatVertOrient>(0, css::text::VertOrientation::NONE, css::text::RelOrientation::FRAME)), m_eSysLanguage(::GetAppLanguage()), @@ -265,7 +263,7 @@ SwBoxAutoFormat::SwBoxAutoFormat() m_aBox->SetAllDistances(55); } -SwBoxAutoFormat::SwBoxAutoFormat( const SwBoxAutoFormat& rNew ) +SwAutoFormatProps::SwAutoFormatProps(const SwAutoFormatProps& rNew) : AutoFormatBase(rNew), m_aTextOrientation(rNew.m_aTextOrientation->Clone()), m_aVerticalAlignment(rNew.m_aVerticalAlignment->Clone()), @@ -275,11 +273,11 @@ SwBoxAutoFormat::SwBoxAutoFormat( const SwBoxAutoFormat& rNew ) { } -SwBoxAutoFormat::~SwBoxAutoFormat() +SwAutoFormatProps::~SwAutoFormatProps() { } -SwBoxAutoFormat& SwBoxAutoFormat::operator=(const SwBoxAutoFormat& rRef) +SwAutoFormatProps& SwAutoFormatProps::operator=(const SwAutoFormatProps& rRef) { // check self-assignment if(this == &rRef) @@ -297,19 +295,15 @@ SwBoxAutoFormat& SwBoxAutoFormat::operator=(const SwBoxAutoFormat& rRef) SetSysLanguage(rRef.GetSysLanguage()); SetNumFormatLanguage(rRef.GetNumFormatLanguage()); - // m_wXObject used to not be copied before 1e2682235cded9a7cd90e55f0bfc60a1285e9a46 - // "WIP: Further preparations for deeper Item changes" by this operator, so do not do it now, too - // rRef.SetXObject(GetXObject()); - return *this; } -bool SwBoxAutoFormat::operator==(const SwBoxAutoFormat& rRight) const +bool SwAutoFormatProps::operator==(const SwAutoFormatProps& rRight) const { return GetBackground().GetColor() == rRight.GetBackground().GetColor(); } -bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ) +bool SwAutoFormatProps::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ) { LoadBlockA( rStream, rVersions, nVer ); @@ -342,7 +336,7 @@ bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sa return ERRCODE_NONE == rStream.GetError(); } -bool SwBoxAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const +bool SwAutoFormatProps::Save( SvStream& rStream, sal_uInt16 fileVersion ) const { SaveBlockA( rStream, fileVersion ); @@ -488,7 +482,7 @@ SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) const SwBoxAutoFormat& SwTableAutoFormat::GetDefaultBoxFormat() { if(!s_pDefaultBoxAutoFormat) - s_pDefaultBoxAutoFormat = new SwBoxAutoFormat(); + s_pDefaultBoxAutoFormat = new SwBoxAutoFormat; return *s_pDefaultBoxAutoFormat; } @@ -507,50 +501,52 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos, m_aBoxAutoFormat[ nPos ] = pFormat; } + SwAutoFormatProps& rBoxProps = pFormat->GetProps(); + if( SwTableAutoFormatUpdateFlags::Char & eFlags ) { - pFormat->SetFont( rSet.Get( RES_CHRATR_FONT ) ); - pFormat->SetHeight( rSet.Get( RES_CHRATR_FONTSIZE ) ); - pFormat->SetWeight( rSet.Get( RES_CHRATR_WEIGHT ) ); - pFormat->SetPosture( rSet.Get( RES_CHRATR_POSTURE ) ); - pFormat->SetCJKFont( rSet.Get( RES_CHRATR_CJK_FONT ) ); - pFormat->SetCJKHeight( rSet.Get( RES_CHRATR_CJK_FONTSIZE ) ); - pFormat->SetCJKWeight( rSet.Get( RES_CHRATR_CJK_WEIGHT ) ); - pFormat->SetCJKPosture( rSet.Get( RES_CHRATR_CJK_POSTURE ) ); - pFormat->SetCTLFont( rSet.Get( RES_CHRATR_CTL_FONT ) ); - pFormat->SetCTLHeight( rSet.Get( RES_CHRATR_CTL_FONTSIZE ) ); - pFormat->SetCTLWeight( rSet.Get( RES_CHRATR_CTL_WEIGHT ) ); - pFormat->SetCTLPosture( rSet.Get( RES_CHRATR_CTL_POSTURE ) ); - pFormat->SetUnderline( rSet.Get( RES_CHRATR_UNDERLINE ) ); - pFormat->SetOverline( rSet.Get( RES_CHRATR_OVERLINE ) ); - pFormat->SetCrossedOut( rSet.Get( RES_CHRATR_CROSSEDOUT ) ); - pFormat->SetContour( rSet.Get( RES_CHRATR_CONTOUR ) ); - pFormat->SetShadowed( rSet.Get( RES_CHRATR_SHADOWED ) ); - pFormat->SetColor( rSet.Get( RES_CHRATR_COLOR ) ); - pFormat->SetAdjust( rSet.Get( RES_PARATR_ADJUST ) ); + rBoxProps.SetFont( rSet.Get( RES_CHRATR_FONT ) ); + rBoxProps.SetHeight( rSet.Get( RES_CHRATR_FONTSIZE ) ); + rBoxProps.SetWeight( rSet.Get( RES_CHRATR_WEIGHT ) ); + rBoxProps.SetPosture( rSet.Get( RES_CHRATR_POSTURE ) ); + rBoxProps.SetCJKFont( rSet.Get( RES_CHRATR_CJK_FONT ) ); + rBoxProps.SetCJKHeight( rSet.Get( RES_CHRATR_CJK_FONTSIZE ) ); + rBoxProps.SetCJKWeight( rSet.Get( RES_CHRATR_CJK_WEIGHT ) ); + rBoxProps.SetCJKPosture( rSet.Get( RES_CHRATR_CJK_POSTURE ) ); + rBoxProps.SetCTLFont( rSet.Get( RES_CHRATR_CTL_FONT ) ); + rBoxProps.SetCTLHeight( rSet.Get( RES_CHRATR_CTL_FONTSIZE ) ); + rBoxProps.SetCTLWeight( rSet.Get( RES_CHRATR_CTL_WEIGHT ) ); + rBoxProps.SetCTLPosture( rSet.Get( RES_CHRATR_CTL_POSTURE ) ); + rBoxProps.SetUnderline( rSet.Get( RES_CHRATR_UNDERLINE ) ); + rBoxProps.SetOverline( rSet.Get( RES_CHRATR_OVERLINE ) ); + rBoxProps.SetCrossedOut( rSet.Get( RES_CHRATR_CROSSEDOUT ) ); + rBoxProps.SetContour( rSet.Get( RES_CHRATR_CONTOUR ) ); + rBoxProps.SetShadowed( rSet.Get( RES_CHRATR_SHADOWED ) ); + rBoxProps.SetColor( rSet.Get( RES_CHRATR_COLOR ) ); + rBoxProps.SetAdjust( rSet.Get( RES_PARATR_ADJUST ) ); } if( !(SwTableAutoFormatUpdateFlags::Box & eFlags) ) return; - pFormat->SetBox( rSet.Get( RES_BOX ) ); + rBoxProps.SetBox( rSet.Get( RES_BOX ) ); // FIXME - add attribute IDs for the diagonal line items -// pFormat->SetTLBR( (SvxLineItem&)rSet.Get( RES_... ) ); -// pFormat->SetBLTR( (SvxLineItem&)rSet.Get( RES_... ) ); - pFormat->SetBackground( rSet.Get( RES_BACKGROUND ) ); - pFormat->SetTextOrientation(rSet.Get(RES_FRAMEDIR)); - pFormat->SetVerticalAlignment(rSet.Get(RES_VERT_ORIENT)); +// rBoxProps.SetTLBR( (SvxLineItem&)rSet.Get( RES_... ) ); +// rBoxProps.SetBLTR( (SvxLineItem&)rSet.Get( RES_... ) ); + rBoxProps.SetBackground( rSet.Get( RES_BACKGROUND ) ); + rBoxProps.SetTextOrientation(rSet.Get(RES_FRAMEDIR)); + rBoxProps.SetVerticalAlignment(rSet.Get(RES_VERT_ORIENT)); const SwTableBoxNumFormat* pNumFormatItem; const SvNumberformat* pNumFormat = nullptr; if( pNFormatr && (pNumFormatItem = rSet.GetItemIfSet( RES_BOXATR_FORMAT )) && nullptr != (pNumFormat = pNFormatr->GetEntry( pNumFormatItem->GetValue() )) ) - pFormat->SetValueFormat( pNumFormat->GetFormatstring(), + rBoxProps.SetValueFormat( pNumFormat->GetFormatstring(), pNumFormat->GetLanguage(), ::GetAppLanguage()); else { // default - pFormat->SetValueFormat( OUString(), LANGUAGE_SYSTEM, + rBoxProps.SetValueFormat( OUString(), LANGUAGE_SYSTEM, ::GetAppLanguage() ); } @@ -560,7 +556,7 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos, void SwTableAutoFormat::UpdateToSet(const sal_uInt8 nPos, const bool bCellSpansToEndV, const bool bCellSpansToEndH, SfxItemSet& rSet, SwTableAutoFormatUpdateFlags eFlags, SvNumberFormatter* pNFormatr) const { - const SwBoxAutoFormat& rChg = GetBoxFormat( nPos ); + const SwAutoFormatProps& rChg = GetBoxFormat(nPos).GetProps(); if( SwTableAutoFormatUpdateFlags::Char & eFlags ) { @@ -629,7 +625,7 @@ void SwTableAutoFormat::UpdateToSet(const sal_uInt8 nPos, const bool bCellSpansT nLastRowOrColumnId = (nPos % 4) + 12; //LAST ROW (12, 13, 14, 15) assert(nLastRowOrColumnId < 16); - const SvxBoxItem& aLastAutoFormatBox(GetBoxFormat(nLastRowOrColumnId).GetBox()); + const SvxBoxItem& aLastAutoFormatBox(GetBoxFormat(nLastRowOrColumnId).GetProps().GetBox()); if (bCellSpansToEndV) aAutoFormatBox.SetLine( aLastAutoFormatBox.GetLine(SvxBoxItemLine::BOTTOM), SvxBoxItemLine::BOTTOM ); if (bCellSpansToEndH) @@ -648,7 +644,7 @@ void SwTableAutoFormat::UpdateToSet(const sal_uInt8 nPos, const bool bCellSpansT // Do not put a VertAlign when it has default value. // It prevents the export of default value by automatic cell-styles export. - if (rChg.GetVerticalAlignment().GetVertOrient() != GetDefaultBoxFormat().GetVerticalAlignment().GetVertOrient()) + if (rChg.GetVerticalAlignment().GetVertOrient() != GetDefaultBoxFormat().GetProps().GetVerticalAlignment().GetVertOrient()) rSet.Put(rChg.GetVerticalAlignment()); if( !(IsValueFormat() && pNFormatr) ) @@ -726,26 +722,26 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable &table) bool SwTableAutoFormat::FirstRowEndColumnIsRow() { - return GetBoxFormat(3) == GetBoxFormat(2); + return GetBoxFormat(3).GetProps() == GetBoxFormat(2).GetProps(); } bool SwTableAutoFormat::FirstRowStartColumnIsRow() { - return GetBoxFormat(0) == GetBoxFormat(1); + return GetBoxFormat(0).GetProps() == GetBoxFormat(1).GetProps(); } bool SwTableAutoFormat::LastRowEndColumnIsRow() { - return GetBoxFormat(14) == GetBoxFormat(15); + return GetBoxFormat(14).GetProps() == GetBoxFormat(15).GetProps(); } bool SwTableAutoFormat::LastRowStartColumnIsRow() { - return GetBoxFormat(12) == GetBoxFormat(13); + return GetBoxFormat(12).GetProps() == GetBoxFormat(13).GetProps(); } bool SwTableAutoFormat::HasHeaderRow() const { // Wild guessing for PDF export: is header different from odd or body? // It would be vastly better to do like SdrTableObj and have flags that // determine which "special" styles apply, instead of horrible guessing. - return !(GetBoxFormat(1) == GetBoxFormat(5)) - || !(GetBoxFormat(1) == GetBoxFormat(10)); + return !(GetBoxFormat(1).GetProps() == GetBoxFormat(5).GetProps()) + || !(GetBoxFormat(1).GetProps() == GetBoxFormat(10).GetProps()); } bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions ) @@ -796,7 +792,7 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions ) for( sal_uInt8 i = 0; bRet && i < 16; ++i ) { SwBoxAutoFormat* pFormat = new SwBoxAutoFormat; - bRet = pFormat->Load( rStream, rVersions, nVal ); + bRet = pFormat->GetProps().Load( rStream, rVersions, nVal ); if( bRet ) m_aBoxAutoFormat[ i ] = pFormat; else @@ -841,7 +837,7 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const const SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ i ]; if (!pFormat) // if not set -> write default pFormat = &SwTableAutoFormat::GetDefaultBoxFormat(); - bRet = pFormat->Save( rStream, fileVersion ); + bRet = pFormat->GetProps().Save( rStream, fileVersion ); } return bRet; } @@ -1045,7 +1041,7 @@ SwTableAutoFormatTable::Impl::Impl() { aBox.SetLine( i <= 3 ? &aLn : nullptr, SvxBoxItemLine::TOP ); aBox.SetLine( (3 == ( i & 3 )) ? &aLn : nullptr, SvxBoxItemLine::RIGHT ); - pNew->GetBoxFormat( i ).SetBox( aBox ); + pNew->GetBoxFormat( i ).GetProps().SetBox( aBox ); } pNew->SetUserDefined(false); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index ada9cd8e0320..0c1861821aca 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -4978,34 +4978,35 @@ void SAL_CALL SwXTextCellStyle::setPropertyValue(const OUString& rPropertyName, const SfxItemPropertyMapEntry *const pEntry = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CELL_STYLE)->getPropertyMap().getByName(rPropertyName); if(pEntry) { + SwAutoFormatProps& rBoxProps = m_pBoxAutoFormat->GetProps(); switch(pEntry->nWID) { case RES_BACKGROUND: { - SvxBrushItem rBrush = m_pBoxAutoFormat->GetBackground(); + SvxBrushItem rBrush = rBoxProps.GetBackground(); rBrush.PutValue(aValue, 0); - m_pBoxAutoFormat->SetBackground(rBrush); + rBoxProps.SetBackground(rBrush); return; } case RES_BOX: { - SvxBoxItem rBox = m_pBoxAutoFormat->GetBox(); + SvxBoxItem rBox = rBoxProps.GetBox(); rBox.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetBox(rBox); + rBoxProps.SetBox(rBox); return; } case RES_VERT_ORIENT: { - SwFormatVertOrient rVertOrient = m_pBoxAutoFormat->GetVerticalAlignment(); + SwFormatVertOrient rVertOrient = rBoxProps.GetVerticalAlignment(); rVertOrient.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetVerticalAlignment(rVertOrient); + rBoxProps.SetVerticalAlignment(rVertOrient); return; } case RES_FRAMEDIR: { - SvxFrameDirectionItem rDirItem = m_pBoxAutoFormat->GetTextOrientation(); + SvxFrameDirectionItem rDirItem = rBoxProps.GetTextOrientation(); rDirItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetTextOrientation(rDirItem); + rBoxProps.SetTextOrientation(rDirItem); return; } case RES_BOXATR_FORMAT: @@ -5019,137 +5020,137 @@ void SAL_CALL SwXTextCellStyle::setPropertyValue(const OUString& rPropertyName, // 2) convert all currencies present in autotbl.fmt before calling this code const SvNumberformat* pNumFormat = m_pDocShell->GetDoc()->GetNumberFormatter()->GetEntry(nKey); if (pNumFormat) - m_pBoxAutoFormat->SetValueFormat(pNumFormat->GetFormatstring(), pNumFormat->GetLanguage(), GetAppLanguage()); + rBoxProps.SetValueFormat(pNumFormat->GetFormatstring(), pNumFormat->GetLanguage(), GetAppLanguage()); } return; } // Paragraph attributes case RES_PARATR_ADJUST: { - SvxAdjustItem rAdjustItem = m_pBoxAutoFormat->GetAdjust(); + SvxAdjustItem rAdjustItem = rBoxProps.GetAdjust(); rAdjustItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetAdjust(rAdjustItem); + rBoxProps.SetAdjust(rAdjustItem); return; } case RES_CHRATR_COLOR: { - SvxColorItem rColorItem = m_pBoxAutoFormat->GetColor(); + SvxColorItem rColorItem = rBoxProps.GetColor(); rColorItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetColor(rColorItem); + rBoxProps.SetColor(rColorItem); return; } case RES_CHRATR_SHADOWED: { - SvxShadowedItem rShadowedItem = m_pBoxAutoFormat->GetShadowed(); + SvxShadowedItem rShadowedItem = rBoxProps.GetShadowed(); bool bValue = false; aValue >>= bValue; rShadowedItem.SetValue(bValue); - m_pBoxAutoFormat->SetShadowed(rShadowedItem); + rBoxProps.SetShadowed(rShadowedItem); return; } case RES_CHRATR_CONTOUR: { - SvxContourItem rContourItem = m_pBoxAutoFormat->GetContour(); + SvxContourItem rContourItem = rBoxProps.GetContour(); bool bValue = false; aValue >>= bValue; rContourItem.SetValue(bValue); - m_pBoxAutoFormat->SetContour(rContourItem); + rBoxProps.SetContour(rContourItem); return; } case RES_CHRATR_CROSSEDOUT: { - SvxCrossedOutItem rCrossedOutItem = m_pBoxAutoFormat->GetCrossedOut(); + SvxCrossedOutItem rCrossedOutItem = rBoxProps.GetCrossedOut(); rCrossedOutItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCrossedOut(rCrossedOutItem); + rBoxProps.SetCrossedOut(rCrossedOutItem); return; } case RES_CHRATR_UNDERLINE: { - SvxUnderlineItem rUnderlineItem = m_pBoxAutoFormat->GetUnderline(); + SvxUnderlineItem rUnderlineItem = rBoxProps.GetUnderline(); rUnderlineItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetUnderline(rUnderlineItem); + rBoxProps.SetUnderline(rUnderlineItem); return; } case RES_CHRATR_FONTSIZE: { - SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetHeight(); + SvxFontHeightItem rFontHeightItem = rBoxProps.GetHeight(); rFontHeightItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetHeight(rFontHeightItem); + rBoxProps.SetHeight(rFontHeightItem); return; } case RES_CHRATR_WEIGHT: { - SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetWeight(); + SvxWeightItem rWeightItem = rBoxProps.GetWeight(); rWeightItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetWeight(rWeightItem); + rBoxProps.SetWeight(rWeightItem); return; } case RES_CHRATR_POSTURE: { - SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetPosture(); + SvxPostureItem rPostureItem = rBoxProps.GetPosture(); rPostureItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetPosture(rPostureItem); + rBoxProps.SetPosture(rPostureItem); return; } case RES_CHRATR_FONT: { - SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont(); + SvxFontItem rFontItem = rBoxProps.GetFont(); rFontItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetFont(rFontItem); + rBoxProps.SetFont(rFontItem); return; } case RES_CHRATR_CJK_FONTSIZE: { - SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight(); + SvxFontHeightItem rFontHeightItem = rBoxProps.GetCJKHeight(); rFontHeightItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKHeight(rFontHeightItem); + rBoxProps.SetCJKHeight(rFontHeightItem); return; } case RES_CHRATR_CJK_WEIGHT: { - SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetCJKWeight(); + SvxWeightItem rWeightItem = rBoxProps.GetCJKWeight(); rWeightItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKWeight(rWeightItem); + rBoxProps.SetCJKWeight(rWeightItem); return; } case RES_CHRATR_CJK_POSTURE: { - SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetCJKPosture(); + SvxPostureItem rPostureItem = rBoxProps.GetCJKPosture(); rPostureItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKPosture(rPostureItem); + rBoxProps.SetCJKPosture(rPostureItem); return; } case RES_CHRATR_CJK_FONT: { - SvxFontItem rFontItem = m_pBoxAutoFormat->GetCJKFont(); + SvxFontItem rFontItem = rBoxProps.GetCJKFont(); rFontItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKFont(rFontItem); + rBoxProps.SetCJKFont(rFontItem); return; } case RES_CHRATR_CTL_FONTSIZE: { - SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight(); + SvxFontHeightItem rFontHeightItem = rBoxProps.GetCTLHeight(); rFontHeightItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLHeight(rFontHeightItem); + rBoxProps.SetCTLHeight(rFontHeightItem); return; } case RES_CHRATR_CTL_WEIGHT: { - SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetCTLWeight(); + SvxWeightItem rWeightItem = rBoxProps.GetCTLWeight(); rWeightItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLWeight(rWeightItem); + rBoxProps.SetCTLWeight(rWeightItem); return; } case RES_CHRATR_CTL_POSTURE: { - SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetCTLPosture(); + SvxPostureItem rPostureItem = rBoxProps.GetCTLPosture(); rPostureItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLPosture(rPostureItem); + rBoxProps.SetCTLPosture(rPostureItem); return; } case RES_CHRATR_CTL_FONT: { - SvxFontItem rFontItem = m_pBoxAutoFormat->GetCTLFont(); + SvxFontItem rFontItem = rBoxProps.GetCTLFont(); rFontItem.PutValue(aValue, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLFont(rFontItem); + rBoxProps.SetCTLFont(rFontItem); return; } default: @@ -5168,29 +5169,30 @@ css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPrope const SfxItemPropertyMapEntry *const pEntry = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CELL_STYLE)->getPropertyMap().getByName(rPropertyName); if(pEntry) { + const SwAutoFormatProps& rBoxProps = m_pBoxAutoFormat->GetProps(); switch(pEntry->nWID) { case RES_BACKGROUND: { - const SvxBrushItem& rBrush = m_pBoxAutoFormat->GetBackground(); + const SvxBrushItem& rBrush = rBoxProps.GetBackground(); rBrush.QueryValue(aRet); return aRet; } case RES_BOX: { - const SvxBoxItem& rBox = m_pBoxAutoFormat->GetBox(); + const SvxBoxItem& rBox = rBoxProps.GetBox(); rBox.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_VERT_ORIENT: { - const SwFormatVertOrient& rVertOrient = m_pBoxAutoFormat->GetVerticalAlignment(); + const SwFormatVertOrient& rVertOrient = rBoxProps.GetVerticalAlignment(); rVertOrient.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_FRAMEDIR: { - const SvxFrameDirectionItem& rDirItem = m_pBoxAutoFormat->GetTextOrientation(); + const SvxFrameDirectionItem& rDirItem = rBoxProps.GetTextOrientation(); rDirItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } @@ -5198,7 +5200,7 @@ css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPrope { OUString sFormat; LanguageType eLng, eSys; - m_pBoxAutoFormat->GetValueFormat(sFormat, eLng, eSys); + rBoxProps.GetValueFormat(sFormat, eLng, eSys); if(!sFormat.isEmpty()) { SvNumFormatType nType; bool bNew; sal_Int32 nCheckPos; @@ -5210,109 +5212,109 @@ css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPrope // Paragraph attributes case RES_PARATR_ADJUST: { - const SvxAdjustItem& rAdjustItem = m_pBoxAutoFormat->GetAdjust(); + const SvxAdjustItem& rAdjustItem = rBoxProps.GetAdjust(); rAdjustItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_COLOR: { - const SvxColorItem& rColorItem = m_pBoxAutoFormat->GetColor(); + const SvxColorItem& rColorItem = rBoxProps.GetColor(); rColorItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_SHADOWED: { - const SvxShadowedItem& rShadowedItem = m_pBoxAutoFormat->GetShadowed(); + const SvxShadowedItem& rShadowedItem = rBoxProps.GetShadowed(); aRet <<= rShadowedItem.GetValue(); return aRet; } case RES_CHRATR_CONTOUR: { - const SvxContourItem& rContourItem = m_pBoxAutoFormat->GetContour(); + const SvxContourItem& rContourItem = rBoxProps.GetContour(); aRet <<= rContourItem.GetValue(); return aRet; } case RES_CHRATR_CROSSEDOUT: { - const SvxCrossedOutItem& rCrossedOutItem = m_pBoxAutoFormat->GetCrossedOut(); + const SvxCrossedOutItem& rCrossedOutItem = rBoxProps.GetCrossedOut(); rCrossedOutItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_UNDERLINE: { - const SvxUnderlineItem& rUnderlineItem = m_pBoxAutoFormat->GetUnderline(); + const SvxUnderlineItem& rUnderlineItem = rBoxProps.GetUnderline(); rUnderlineItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_FONTSIZE: { - const SvxFontHeightItem& rFontHeightItem = m_pBoxAutoFormat->GetHeight(); + const SvxFontHeightItem& rFontHeightItem = rBoxProps.GetHeight(); rFontHeightItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_WEIGHT: { - const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetWeight(); + const SvxWeightItem& rWeightItem = rBoxProps.GetWeight(); rWeightItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_POSTURE: { - const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetPosture(); + const SvxPostureItem& rPostureItem = rBoxProps.GetPosture(); rPostureItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_FONT: { - const SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont(); + const SvxFontItem rFontItem = rBoxProps.GetFont(); rFontItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CJK_FONTSIZE: { - const SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight(); + const SvxFontHeightItem rFontHeightItem = rBoxProps.GetCJKHeight(); rFontHeightItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CJK_WEIGHT: { - const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetCJKWeight(); + const SvxWeightItem& rWeightItem = rBoxProps.GetCJKWeight(); rWeightItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CJK_POSTURE: { - const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetCJKPosture(); + const SvxPostureItem& rPostureItem = rBoxProps.GetCJKPosture(); rPostureItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CJK_FONT: { - const SvxFontItem rFontItem = m_pBoxAutoFormat->GetCJKFont(); + const SvxFontItem rFontItem = rBoxProps.GetCJKFont(); rFontItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CTL_FONTSIZE: { - const SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight(); + const SvxFontHeightItem rFontHeightItem = rBoxProps.GetCTLHeight(); rFontHeightItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CTL_WEIGHT: { - const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetCTLWeight(); + const SvxWeightItem& rWeightItem = rBoxProps.GetCTLWeight(); rWeightItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CTL_POSTURE: { - const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetCTLPosture(); + const SvxPostureItem& rPostureItem = rBoxProps.GetCTLPosture(); rPostureItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } case RES_CHRATR_CTL_FONT: { - const SvxFontItem rFontItem = m_pBoxAutoFormat->GetCTLFont(); + const SvxFontItem rFontItem = rBoxProps.GetCTLFont(); rFontItem.QueryValue(aRet, pEntry->nMemberId); return aRet; } @@ -5359,9 +5361,10 @@ css::uno::Sequence<css::beans::PropertyState> SAL_CALL SwXTextCellStyle::getProp SolarMutexGuard aGuard; uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength()); beans::PropertyState* pStates = aRet.getArray(); - const SwBoxAutoFormat& rDefaultBoxFormat = SwTableAutoFormat::GetDefaultBoxFormat(); + const SwAutoFormatProps& rDefaultBoxProps = SwTableAutoFormat::GetDefaultBoxFormat().GetProps(); const SfxItemPropertyMap& rMap = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CELL_STYLE)->getPropertyMap(); const OUString* pNames = aPropertyNames.getConstArray(); + const SwAutoFormatProps& rBoxProps = m_pBoxAutoFormat->GetProps(); for(sal_Int32 i=0; i < aPropertyNames.getLength(); ++i) { const OUString sPropName = pNames[i]; @@ -5372,121 +5375,121 @@ css::uno::Sequence<css::beans::PropertyState> SAL_CALL SwXTextCellStyle::getProp switch(pEntry->nWID) { case RES_BACKGROUND: - m_pBoxAutoFormat->GetBackground().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetBackground().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetBackground().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetBackground().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_BOX: - m_pBoxAutoFormat->GetBox().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetBox().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetBox().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetBox().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_VERT_ORIENT: - m_pBoxAutoFormat->GetVerticalAlignment().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetVerticalAlignment().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetVerticalAlignment().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetVerticalAlignment().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_FRAMEDIR: - m_pBoxAutoFormat->GetTextOrientation().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetTextOrientation().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetTextOrientation().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetTextOrientation().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_BOXATR_FORMAT: { OUString sFormat; LanguageType eLng, eSys; - m_pBoxAutoFormat->GetValueFormat(sFormat, eLng, eSys); + rBoxProps.GetValueFormat(sFormat, eLng, eSys); pStates[i] = sFormat.isEmpty() ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; } case RES_PARATR_ADJUST: - m_pBoxAutoFormat->GetAdjust().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetAdjust().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetAdjust().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetAdjust().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_COLOR: - m_pBoxAutoFormat->GetColor().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetColor().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetColor().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetColor().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_SHADOWED: - m_pBoxAutoFormat->GetShadowed().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetShadowed().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetShadowed().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetShadowed().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CONTOUR: - m_pBoxAutoFormat->GetContour().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetContour().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetContour().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetContour().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CROSSEDOUT: - m_pBoxAutoFormat->GetCrossedOut().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCrossedOut().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCrossedOut().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCrossedOut().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_UNDERLINE: - m_pBoxAutoFormat->GetUnderline().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetUnderline().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetUnderline().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetUnderline().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_FONTSIZE: - m_pBoxAutoFormat->GetHeight().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetHeight().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetHeight().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetHeight().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_WEIGHT: - m_pBoxAutoFormat->GetWeight().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetWeight().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetWeight().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetWeight().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_POSTURE: - m_pBoxAutoFormat->GetPosture().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetPosture().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetPosture().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetPosture().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_FONT: - m_pBoxAutoFormat->GetFont().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetFont().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetFont().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetFont().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CJK_FONTSIZE: - m_pBoxAutoFormat->GetCJKHeight().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCJKHeight().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCJKHeight().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCJKHeight().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CJK_WEIGHT: - m_pBoxAutoFormat->GetCJKWeight().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCJKWeight().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCJKWeight().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCJKWeight().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CJK_POSTURE: - m_pBoxAutoFormat->GetCJKPosture().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCJKPosture().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCJKPosture().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCJKPosture().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CJK_FONT: - m_pBoxAutoFormat->GetCJKFont().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCJKFont().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCJKFont().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCJKFont().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CTL_FONTSIZE: - m_pBoxAutoFormat->GetCTLHeight().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCTLHeight().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCTLHeight().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCTLHeight().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CTL_WEIGHT: - m_pBoxAutoFormat->GetCTLWeight().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCTLWeight().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCTLWeight().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCTLWeight().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CTL_POSTURE: - m_pBoxAutoFormat->GetCTLPosture().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCTLPosture().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCTLPosture().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCTLPosture().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; case RES_CHRATR_CTL_FONT: - m_pBoxAutoFormat->GetCTLFont().QueryValue(aAny1, pEntry->nMemberId); - rDefaultBoxFormat.GetCTLFont().QueryValue(aAny2, pEntry->nMemberId); + rBoxProps.GetCTLFont().QueryValue(aAny1, pEntry->nMemberId); + rDefaultBoxProps.GetCTLFont().QueryValue(aAny2, pEntry->nMemberId); pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; break; default: @@ -5507,197 +5510,199 @@ css::uno::Sequence<css::beans::PropertyState> SAL_CALL SwXTextCellStyle::getProp void SAL_CALL SwXTextCellStyle::setPropertyToDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; - const SwBoxAutoFormat& rDefaultBoxFormat = SwTableAutoFormat::GetDefaultBoxFormat(); + const SwAutoFormatProps& rDefaultBoxProps = SwTableAutoFormat::GetDefaultBoxFormat().GetProps(); const SfxItemPropertyMap& rMap = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CELL_STYLE)->getPropertyMap(); const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropertyName); if(!pEntry) return; + SwAutoFormatProps& rBoxProps = m_pBoxAutoFormat->GetProps(); + uno::Any aAny; switch(pEntry->nWID) { case RES_BACKGROUND: { - SvxBrushItem rBrush = m_pBoxAutoFormat->GetBackground(); - rDefaultBoxFormat.GetBackground().QueryValue(aAny, pEntry->nMemberId); + SvxBrushItem rBrush = rBoxProps.GetBackground(); + rDefaultBoxProps.GetBackground().QueryValue(aAny, pEntry->nMemberId); rBrush.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetBackground(rBrush); + rBoxProps.SetBackground(rBrush); break; } case RES_BOX: { - SvxBoxItem rBox = m_pBoxAutoFormat->GetBox(); - rDefaultBoxFormat.GetBox().QueryValue(aAny, pEntry->nMemberId); + SvxBoxItem rBox = rBoxProps.GetBox(); + rDefaultBoxProps.GetBox().QueryValue(aAny, pEntry->nMemberId); rBox.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetBox(rBox); + rBoxProps.SetBox(rBox); break; } case RES_VERT_ORIENT: { - SwFormatVertOrient rVertOrient = m_pBoxAutoFormat->GetVerticalAlignment(); - rDefaultBoxFormat.GetVerticalAlignment().QueryValue(aAny, pEntry->nMemberId); + SwFormatVertOrient rVertOrient = rBoxProps.GetVerticalAlignment(); + rDefaultBoxProps.GetVerticalAlignment().QueryValue(aAny, pEntry->nMemberId); rVertOrient.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetVerticalAlignment(rVertOrient); + rBoxProps.SetVerticalAlignment(rVertOrient); break; } case RES_FRAMEDIR: { - SvxFrameDirectionItem rFrameDirectionItem = m_pBoxAutoFormat->GetTextOrientation(); - rDefaultBoxFormat.GetTextOrientation().QueryValue(aAny, pEntry->nMemberId); + SvxFrameDirectionItem rFrameDirectionItem = rBoxProps.GetTextOrientation(); + rDefaultBoxProps.GetTextOrientation().QueryValue(aAny, pEntry->nMemberId); rFrameDirectionItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetTextOrientation(rFrameDirectionItem); + rBoxProps.SetTextOrientation(rFrameDirectionItem); break; } case RES_BOXATR_FORMAT: { OUString sFormat; LanguageType eLng, eSys; - rDefaultBoxFormat.GetValueFormat(sFormat, eLng, eSys); - m_pBoxAutoFormat->SetValueFormat(sFormat, eLng, eSys); + rDefaultBoxProps.GetValueFormat(sFormat, eLng, eSys); + rBoxProps.SetValueFormat(sFormat, eLng, eSys); break; } case RES_PARATR_ADJUST: { - SvxAdjustItem rAdjustItem = m_pBoxAutoFormat->GetAdjust(); - rDefaultBoxFormat.GetAdjust().QueryValue(aAny, pEntry->nMemberId); + SvxAdjustItem rAdjustItem = rBoxProps.GetAdjust(); + rDefaultBoxProps.GetAdjust().QueryValue(aAny, pEntry->nMemberId); rAdjustItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetAdjust(rAdjustItem); + rBoxProps.SetAdjust(rAdjustItem); break; } case RES_CHRATR_COLOR: { - SvxColorItem rColorItem = m_pBoxAutoFormat->GetColor(); - rDefaultBoxFormat.GetColor().QueryValue(aAny, pEntry->nMemberId); + SvxColorItem rColorItem = rBoxProps.GetColor(); + rDefaultBoxProps.GetColor().QueryValue(aAny, pEntry->nMemberId); rColorItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetColor(rColorItem); + rBoxProps.SetColor(rColorItem); break; } case RES_CHRATR_SHADOWED: { - SvxShadowedItem rShadowedItem = m_pBoxAutoFormat->GetShadowed(); - rDefaultBoxFormat.GetShadowed().QueryValue(aAny, pEntry->nMemberId); + SvxShadowedItem rShadowedItem = rBoxProps.GetShadowed(); + rDefaultBoxProps.GetShadowed().QueryValue(aAny, pEntry->nMemberId); rShadowedItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetShadowed(rShadowedItem); + rBoxProps.SetShadowed(rShadowedItem); break; } case RES_CHRATR_CONTOUR: { - SvxContourItem rContourItem = m_pBoxAutoFormat->GetContour(); - rDefaultBoxFormat.GetContour().QueryValue(aAny, pEntry->nMemberId); + SvxContourItem rContourItem = rBoxProps.GetContour(); + rDefaultBoxProps.GetContour().QueryValue(aAny, pEntry->nMemberId); rContourItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetContour(rContourItem); + rBoxProps.SetContour(rContourItem); break; } case RES_CHRATR_CROSSEDOUT: { - SvxCrossedOutItem rCrossedOutItem = m_pBoxAutoFormat->GetCrossedOut(); - rDefaultBoxFormat.GetCrossedOut().QueryValue(aAny, pEntry->nMemberId); + SvxCrossedOutItem rCrossedOutItem = rBoxProps.GetCrossedOut(); + rDefaultBoxProps.GetCrossedOut().QueryValue(aAny, pEntry->nMemberId); rCrossedOutItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCrossedOut(rCrossedOutItem); + rBoxProps.SetCrossedOut(rCrossedOutItem); break; } case RES_CHRATR_UNDERLINE: { - SvxUnderlineItem rUnderlineItem = m_pBoxAutoFormat->GetUnderline(); - rDefaultBoxFormat.GetUnderline().QueryValue(aAny, pEntry->nMemberId); + SvxUnderlineItem rUnderlineItem = rBoxProps.GetUnderline(); + rDefaultBoxProps.GetUnderline().QueryValue(aAny, pEntry->nMemberId); rUnderlineItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetUnderline(rUnderlineItem); + rBoxProps.SetUnderline(rUnderlineItem); break; } case RES_CHRATR_FONTSIZE: { - SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetHeight(); - rDefaultBoxFormat.GetHeight().QueryValue(aAny, pEntry->nMemberId); + SvxFontHeightItem rFontHeightItem = rBoxProps.GetHeight(); + rDefaultBoxProps.GetHeight().QueryValue(aAny, pEntry->nMemberId); rFontHeightItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetHeight(rFontHeightItem); + rBoxProps.SetHeight(rFontHeightItem); break; } case RES_CHRATR_WEIGHT: { - SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetWeight(); - rDefaultBoxFormat.GetWeight().QueryValue(aAny, pEntry->nMemberId); + SvxWeightItem rWeightItem = rBoxProps.GetWeight(); + rDefaultBoxProps.GetWeight().QueryValue(aAny, pEntry->nMemberId); rWeightItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetWeight(rWeightItem); + rBoxProps.SetWeight(rWeightItem); break; } case RES_CHRATR_POSTURE: { - SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetPosture(); - rDefaultBoxFormat.GetPosture().QueryValue(aAny, pEntry->nMemberId); + SvxPostureItem rPostureItem = rBoxProps.GetPosture(); + rDefaultBoxProps.GetPosture().QueryValue(aAny, pEntry->nMemberId); rPostureItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetPosture(rPostureItem); + rBoxProps.SetPosture(rPostureItem); break; } case RES_CHRATR_FONT: { - SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont(); - rDefaultBoxFormat.GetFont().QueryValue(aAny, pEntry->nMemberId); + SvxFontItem rFontItem = rBoxProps.GetFont(); + rDefaultBoxProps.GetFont().QueryValue(aAny, pEntry->nMemberId); rFontItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetFont(rFontItem); + rBoxProps.SetFont(rFontItem); break; } case RES_CHRATR_CJK_FONTSIZE: { - SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight(); - rDefaultBoxFormat.GetCJKHeight().QueryValue(aAny, pEntry->nMemberId); + SvxFontHeightItem rFontHeightItem = rBoxProps.GetCJKHeight(); + rDefaultBoxProps.GetCJKHeight().QueryValue(aAny, pEntry->nMemberId); rFontHeightItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKHeight(rFontHeightItem); + rBoxProps.SetCJKHeight(rFontHeightItem); break; } case RES_CHRATR_CJK_WEIGHT: { - SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetCJKWeight(); - rDefaultBoxFormat.GetCJKWeight().QueryValue(aAny, pEntry->nMemberId); + SvxWeightItem rWeightItem = rBoxProps.GetCJKWeight(); + rDefaultBoxProps.GetCJKWeight().QueryValue(aAny, pEntry->nMemberId); rWeightItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKWeight(rWeightItem); + rBoxProps.SetCJKWeight(rWeightItem); break; } case RES_CHRATR_CJK_POSTURE: { - SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetCJKPosture(); - rDefaultBoxFormat.GetCJKPosture().QueryValue(aAny, pEntry->nMemberId); + SvxPostureItem rPostureItem = rBoxProps.GetCJKPosture(); + rDefaultBoxProps.GetCJKPosture().QueryValue(aAny, pEntry->nMemberId); rPostureItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKPosture(rPostureItem); + rBoxProps.SetCJKPosture(rPostureItem); break; } case RES_CHRATR_CJK_FONT: { - SvxFontItem rFontItem = m_pBoxAutoFormat->GetCJKFont(); - rDefaultBoxFormat.GetCJKFont().QueryValue(aAny, pEntry->nMemberId); + SvxFontItem rFontItem = rBoxProps.GetCJKFont(); + rDefaultBoxProps.GetCJKFont().QueryValue(aAny, pEntry->nMemberId); rFontItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCJKFont(rFontItem); + rBoxProps.SetCJKFont(rFontItem); break; } case RES_CHRATR_CTL_FONTSIZE: { - SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight(); - rDefaultBoxFormat.GetCTLHeight().QueryValue(aAny, pEntry->nMemberId); + SvxFontHeightItem rFontHeightItem = rBoxProps.GetCTLHeight(); + rDefaultBoxProps.GetCTLHeight().QueryValue(aAny, pEntry->nMemberId); rFontHeightItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLHeight(rFontHeightItem); + rBoxProps.SetCTLHeight(rFontHeightItem); break; } case RES_CHRATR_CTL_WEIGHT: { - SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetCTLWeight(); - rDefaultBoxFormat.GetCTLWeight().QueryValue(aAny, pEntry->nMemberId); + SvxWeightItem rWeightItem = rBoxProps.GetCTLWeight(); + rDefaultBoxProps.GetCTLWeight().QueryValue(aAny, pEntry->nMemberId); rWeightItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLWeight(rWeightItem); + rBoxProps.SetCTLWeight(rWeightItem); break; } case RES_CHRATR_CTL_POSTURE: { - SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetCTLPosture(); - rDefaultBoxFormat.GetCTLPosture().QueryValue(aAny, pEntry->nMemberId); + SvxPostureItem rPostureItem = rBoxProps.GetCTLPosture(); + rDefaultBoxProps.GetCTLPosture().QueryValue(aAny, pEntry->nMemberId); rPostureItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLPosture(rPostureItem); + rBoxProps.SetCTLPosture(rPostureItem); break; } case RES_CHRATR_CTL_FONT: { - SvxFontItem rFontItem = m_pBoxAutoFormat->GetCTLFont(); - rDefaultBoxFormat.GetCTLFont().QueryValue(aAny, pEntry->nMemberId); + SvxFontItem rFontItem = rBoxProps.GetCTLFont(); + rDefaultBoxProps.GetCTLFont().QueryValue(aAny, pEntry->nMemberId); rFontItem.PutValue(aAny, pEntry->nMemberId); - m_pBoxAutoFormat->SetCTLFont(rFontItem); + rBoxProps.SetCTLFont(rFontItem); break; } default: diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx index cc083e739500..193d289793d1 100644 --- a/sw/source/ui/table/autoformatpreview.cxx +++ b/sw/source/ui/table/autoformatpreview.cxx @@ -103,7 +103,7 @@ static void lcl_SetFontProperties(vcl::Font& rFont, const SvxFontItem& rFontItem void AutoFormatPreview::MakeFonts(vcl::RenderContext const& rRenderContext, sal_uInt8 nIndex, vcl::Font& rFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont) { - const SwBoxAutoFormat& rBoxFormat = maCurrentData.GetBoxFormat(nIndex); + const SwAutoFormatProps& rBoxFormat = maCurrentData.GetBoxFormat(nIndex).GetProps(); rFont = rCJKFont = rCTLFont = rRenderContext.GetFont(); Size aFontSize(rFont.GetFontSize().Width(), 10 * rRenderContext.GetDPIScaleFactor()); @@ -216,7 +216,9 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC { OUString sFormat; LanguageType eLng, eSys; - maCurrentData.GetBoxFormat(sal_uInt8(nNum)).GetValueFormat(sFormat, eLng, eSys); + maCurrentData.GetBoxFormat(sal_uInt8(nNum)) + .GetProps() + .GetValueFormat(sFormat, eLng, eSys); SvNumFormatType nType; bool bNew; @@ -284,7 +286,7 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC aPos.AdjustX(nRightX); else if (maCurrentData.IsJustify()) { - const SvxAdjustItem& rAdj = maCurrentData.GetBoxFormat(nFormatIndex).GetAdjust(); + const SvxAdjustItem& rAdj = maCurrentData.GetBoxFormat(nFormatIndex).GetProps().GetAdjust(); switch (rAdj.GetAdjust()) { case SvxAdjust::Left: @@ -323,7 +325,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext) for (size_t nCol = 0; nCol < 5; ++nCol) { SvxBrushItem aBrushItem( - maCurrentData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetBackground()); + maCurrentData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetProps().GetBackground()); rRenderContext.Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); rRenderContext.SetLineColor(); @@ -404,7 +406,7 @@ void AutoFormatPreview::CalcLineMap() svx::frame::Style aStyle; const SvxBoxItem& rItem - = maCurrentData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetBox(); + = maCurrentData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetProps().GetBox(); lclSetStyleFromBorder(aStyle, rItem.GetLeft()); maArray.SetCellStyleLeft(nCol, nRow, aStyle); lclSetStyleFromBorder(aStyle, rItem.GetRight());