11#include <ThemeColorChanger.hxx>
26#include <UndoThemeChange.hxx>
37#include <com/sun/star/text/XTextRange.hpp>
38#include <com/sun/star/container/XEnumerationAccess.hpp>
39#include <com/sun/star/container/XEnumeration.hpp>
40#include <com/sun/star/beans/XPropertySet.hpp>
79 : mrDocument(rDocument)
80 , mrColorSet(rColorSet)
91 for (
size_t i = 0;
i < rHints.
Count(); ++
i)
98 std::shared_ptr<SfxItemSet> pStyleHandle(rAutoFormatPool.GetStyleHandle());
106 auto pNew = pItem->Clone();
107 pNew->SetValue(aNewColor);
121 auto pNew = pItem->Clone();
122 pNew->SetColor(aNewColor);
135 auto pNew = pItem->Clone();
136 pNew->SetColor(aNewColor);
146 void updateParagraphAttributes(
SwTextNode* pTextNode)
162 std::unique_ptr<SvxColorItem> pNewItem(pItem->Clone());
163 pNewItem->setColor(aNewColor);
178 std::unique_ptr<SvxUnderlineItem> pNewItem(pItem->Clone());
179 pNewItem->SetColor(aNewColor);
194 std::unique_ptr<SvxOverlineItem> pNewItem(pItem->Clone());
195 pNewItem->SetColor(aNewColor);
210 std::unique_ptr<XFillColorItem> pNewItem(pItem->Clone());
211 pNewItem->SetColorValue(aNewColor);
219 std::unique_ptr<SvxBoxItem> pNewItem(pItem->Clone());
221 bool bChanged =
false;
223 bChanged = changeBorderLine(pNewItem->GetBottom(), mrColorSet) || bChanged;
224 bChanged = changeBorderLine(pNewItem->GetTop(), mrColorSet) || bChanged;
225 bChanged = changeBorderLine(pNewItem->GetLeft(), mrColorSet) || bChanged;
226 bChanged = changeBorderLine(pNewItem->GetRight(), mrColorSet) || bChanged;
235 void handleNode(
SwNode* pNode)
override
244 void handleSdrObject(
SdrObject* pObject)
override
254 while (aIter.IsMore())
273 aItem.SetColor(aColor);
289 aItem.SetColor(aColor);
304 aColorItem.SetValue(aColor);
305 rNewSet.
Put(aColorItem);
319 aFillItem.SetColorValue(aColor);
320 rNewSet.
Put(aFillItem);
327 bool bChange =
false;
329 bChange = changeBorderLine(aBoxItem.GetBottom(), rColorSet) || bChange;
330 bChange = changeBorderLine(aBoxItem.GetTop(), rColorSet) || bChange;
331 bChange = changeBorderLine(aBoxItem.GetLeft(), rColorSet) || bChange;
332 bChange = changeBorderLine(aBoxItem.GetRight(), rColorSet) || bChange;
335 rNewSet.
Put(aBoxItem);
361 pTheme = std::make_shared<model::Theme>(
"Office");
365 std::shared_ptr<model::ColorSet> pNewColorSet = pColorSet;
366 std::shared_ptr<model::ColorSet> pOldColorSet = pTheme->getColorSet();
367 pTheme->setColorSet(pNewColorSet);
369 auto pUndoThemeChange
370 = std::make_unique<sw::UndoThemeChange>(*pDocument, pOldColorSet, pNewColorSet);
379 std::unique_ptr<SfxItemSet> pNewSet = rAttrSet.
Clone();
381 bool bChanged =
false;
382 bChanged = bChanged || changeBackground(rAttrSet, *pNewSet, *pColorSet);
383 bChanged = bChanged || changeBox(rAttrSet, *pNewSet, *pColorSet);
403 std::unique_ptr<SfxItemSet> pNewSet = rAttrSet.
Clone();
405 bool bChanged =
false;
406 bChanged = changeBackground(rAttrSet, *pNewSet, *pColorSet) || bChanged;
407 bChanged = changeBox(rAttrSet, *pNewSet, *pColorSet) || bChanged;
410 pDocument->
ChgFormat(*pFrameFormat, *pNewSet);
420 if (pTextFormatCollection)
423 std::unique_ptr<SfxItemSet> pNewSet = rAttrSet.
Clone();
425 bool bChanged =
false;
426 bChanged = changeColor(rAttrSet, *pNewSet, *pColorSet) || bChanged;
427 bChanged = changeOverlineColor(rAttrSet, *pNewSet, *pColorSet) || bChanged;
428 bChanged = changeUnderlineColor(rAttrSet, *pNewSet, *pColorSet) || bChanged;
429 bChanged = changeBox(rAttrSet, *pNewSet, *pColorSet) || bChanged;
430 bChanged = changeBackground(rAttrSet, *pNewSet, *pColorSet) || bChanged;
434 pDocument->
ChgFormat(*pTextFormatCollection, *pNewSet);
449 std::unique_ptr<SfxItemSet> pNewSet = rAttrSet.
Clone();
451 bool bChanged =
false;
452 bChanged = changeColor(rAttrSet, *pNewSet, *pColorSet) || bChanged;
453 bChanged = changeOverlineColor(rAttrSet, *pNewSet, *pColorSet) || bChanged;
454 bChanged = changeUnderlineColor(rAttrSet, *pNewSet, *pColorSet) || bChanged;
456 pDocument->
ChgFormat(*pCharFormat, *pNewSet);
462 auto pHandler = std::make_shared<ThemeColorHandler>(*pDocument, *pColorSet);
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
const SdrPage * GetPage(sal_uInt16 nPgNum) const
std::shared_ptr< model::Theme > const & GetTheme() const
void SetTheme(std::shared_ptr< model::Theme > const &pTheme)
SdrPageProperties & getSdrPageProperties()
void Broadcast(const SfxHint &rHint)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
SfxStyleSheetBase * Next()
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const override
bool HasSwAttrSet() const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
SwDoc * GetDoc()
returns Doc. But be careful!
SwFrameFormat * GetFrameFormat()
SwCharFormat * GetCharFormat()
SwTextFormatColl * GetCollection()
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
size_t GetPageDescCnt() const
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
const SwPageDesc & GetPageDesc(const size_t i) const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
PaM is Point and Mark: a selection of the document model.
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
sal_Int32 GetAnyEnd() const
end (if available), else start
sal_Int32 GetStart() const
const SwFormatAutoFormat & GetAutoFormat() const
Represents the style of a paragraph.
SwTextNode is a paragraph in the document model.
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
SwpHints & GetSwpHints()
getters for SwpHints
An SwTextAttr container, stores all directly formatted text portions for a text node.
SwTextAttr * Get(size_t nPos) const
void SetColor(const Color &rColor)
model::ComplexColor const & getComplexColor() const
Color resolveColor(model::ComplexColor const &rComplexColor) const
ThemeColorType meSchemeType
ThemeColorType getSchemeType() const
void addNodeHandler(std::shared_ptr< ModelTraverseHandler > pHandler)
void apply(std::shared_ptr< model::ColorSet > const &pColorSet) override
ThemeColorChanger(SwDocShell *pDocSh)
virtual ~ThemeColorChanger() override
EmbeddedObjectRef * pObject
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SvxOverlineItem > RES_CHRATR_OVERLINE(38)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
void updateSdrObject(model::ColorSet const &rColorSet, SdrObject *pObject)
Dialog to specify the properties of date form field.
@ NO_CURSOR_CHANGE
don't change the cursor position