office-gobmx/sw/source/uibase/config/cfgitems.cxx
Heiko Tietze 0b7d01a1a2 Related tdf#74386 - Improvements for text boundaries options
* Default is Crop Marks now
* Settings are persistent

Change-Id: If5304c874706345fa943a106044155152c86bc0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176131
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2024-11-08 10:16:58 +01:00

305 lines
11 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <viewopt.hxx>
#include <cmdid.h>
#include <cfgitems.hxx>
#include <crstate.hxx>
SwDocDisplayItem::SwDocDisplayItem() :
SfxPoolItem(FN_PARAM_DOCDISP, SfxItemType::SwDocDisplayItemType)
{
m_bParagraphEnd =
m_bTab =
m_bSpace =
m_bNonbreakingSpace =
m_bSoftHyphen =
m_bCharHiddenText =
m_bBookmarks =
m_bManualBreak = true;
m_bTextBoundariesFull = false; // default is crop
m_xDefaultAnchor = 1; //FLY_TO_CHAR
};
// Item for the Settings dialog, page document view
SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt ) :
SfxPoolItem( FN_PARAM_DOCDISP, SfxItemType::SwDocDisplayItemType )
{
m_bParagraphEnd = rVOpt.IsParagraph(true);
m_bTab = rVOpt.IsTab(true);
m_bSpace = rVOpt.IsBlank(true);
m_bNonbreakingSpace = rVOpt.IsHardBlank();
m_bSoftHyphen = rVOpt.IsSoftHyph();
m_bCharHiddenText = rVOpt.IsShowHiddenChar(true);
m_bBookmarks = rVOpt.IsShowBookmarks(true);
m_bManualBreak = rVOpt.IsLineBreak(true);
m_bTextBoundariesFull = rVOpt.IsTextBoundariesFull();
m_xDefaultAnchor = rVOpt.GetDefaultAnchor();
}
SwDocDisplayItem* SwDocDisplayItem::Clone( SfxItemPool* ) const
{
return new SwDocDisplayItem( *this );
}
bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
const SwDocDisplayItem& rItem = static_cast<const SwDocDisplayItem&>(rAttr);
return ( m_bParagraphEnd == rItem.m_bParagraphEnd &&
m_bTab == rItem.m_bTab &&
m_bSpace == rItem.m_bSpace &&
m_bNonbreakingSpace == rItem.m_bNonbreakingSpace &&
m_bSoftHyphen == rItem.m_bSoftHyphen &&
m_bCharHiddenText == rItem.m_bCharHiddenText &&
m_bBookmarks == rItem.m_bBookmarks &&
m_bManualBreak == rItem.m_bManualBreak &&
m_bTextBoundariesFull == rItem.m_bTextBoundariesFull &&
m_xDefaultAnchor == rItem.m_xDefaultAnchor);
}
void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const
{
rVOpt.SetParagraph (m_bParagraphEnd );
rVOpt.SetTab (m_bTab );
rVOpt.SetBlank (m_bSpace );
rVOpt.SetHardBlank (m_bNonbreakingSpace );
rVOpt.SetSoftHyph (m_bSoftHyphen );
rVOpt.SetShowHiddenChar(m_bCharHiddenText );
rVOpt.SetShowBookmarks(m_bBookmarks );
rVOpt.SetLineBreak (m_bManualBreak );
rVOpt.SetTextBoundariesFull(m_bTextBoundariesFull);
rVOpt.SetDefaultAnchor( m_xDefaultAnchor );
}
SwElemItem::SwElemItem() :
SfxPoolItem(FN_PARAM_ELEM, SfxItemType::SwElemItemType)
{
m_bVertRuler =
m_bVertRulerRight=
m_bCrosshair =
m_bSmoothScroll =
m_bTable =
m_bGraphic =
m_bDrawing =
m_bNotes = false;
m_bShowInlineTooltips = true;
m_bShowOutlineContentVisibilityButton =
m_bTreatSubOutlineLevelsAsContent =
m_bShowChangesInMargin =
m_bFieldHiddenText =
m_bShowHiddenPara = false;
m_bDefaultZoom = true;
m_eDefaultZoomType = SvxZoomType::PERCENT;
m_nDefaultZoomValue = 100;
}
SwElemItem::SwElemItem(const SwViewOption& rVOpt) :
SfxPoolItem( FN_PARAM_ELEM, SfxItemType::SwElemItemType )
{
m_bVertRuler = rVOpt.IsViewVRuler(true);
m_bVertRulerRight = rVOpt.IsVRulerRight();
m_bCrosshair = rVOpt.IsCrossHair();
m_bSmoothScroll = rVOpt.IsSmoothScroll();
m_bTable = rVOpt.IsTable();
m_bGraphic = rVOpt.IsGraphic();
m_bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
m_bNotes = rVOpt.IsPostIts();
m_bShowInlineTooltips = rVOpt.IsShowInlineTooltips();
m_bShowOutlineContentVisibilityButton = rVOpt.IsShowOutlineContentVisibilityButton();
m_bTreatSubOutlineLevelsAsContent = rVOpt.IsTreatSubOutlineLevelsAsContent();
m_bShowChangesInMargin = rVOpt.IsShowChangesInMargin();
m_bFieldHiddenText = rVOpt.IsShowHiddenField();
m_bShowHiddenPara = rVOpt.IsShowHiddenPara();
m_bDefaultZoom = false;
m_eDefaultZoomType = rVOpt.GetZoomType();
m_nDefaultZoomValue = rVOpt.GetZoom();
}
SwElemItem* SwElemItem::Clone( SfxItemPool* ) const
{
return new SwElemItem( *this );
}
bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
const SwElemItem& rItem = static_cast<const SwElemItem&>(rAttr);
return ( m_bVertRuler == rItem.m_bVertRuler &&
m_bVertRulerRight == rItem.m_bVertRulerRight&&
m_bCrosshair == rItem.m_bCrosshair &&
m_bSmoothScroll == rItem.m_bSmoothScroll &&
m_bTable == rItem.m_bTable &&
m_bGraphic == rItem.m_bGraphic &&
m_bDrawing == rItem.m_bDrawing &&
m_bNotes == rItem.m_bNotes &&
m_bShowInlineTooltips == rItem.m_bShowInlineTooltips &&
m_bShowOutlineContentVisibilityButton == rItem.m_bShowOutlineContentVisibilityButton &&
m_bTreatSubOutlineLevelsAsContent == rItem.m_bTreatSubOutlineLevelsAsContent &&
m_bShowChangesInMargin == rItem.m_bShowChangesInMargin &&
m_bFieldHiddenText == rItem.m_bFieldHiddenText &&
m_bShowHiddenPara == rItem.m_bShowHiddenPara &&
m_bDefaultZoom == rItem.m_bDefaultZoom &&
m_eDefaultZoomType == rItem.m_eDefaultZoomType &&
m_nDefaultZoomValue == rItem.m_nDefaultZoomValue );
}
void SwElemItem::FillViewOptions( SwViewOption& rVOpt) const
{
rVOpt.SetViewVRuler(m_bVertRuler );
rVOpt.SetVRulerRight(m_bVertRulerRight );
rVOpt.SetCrossHair(m_bCrosshair );
rVOpt.SetSmoothScroll(m_bSmoothScroll);
rVOpt.SetTable (m_bTable );
rVOpt.SetGraphic (m_bGraphic );
rVOpt.SetDraw (m_bDrawing );
rVOpt.SetControl (m_bDrawing );
rVOpt.SetPostIts (m_bNotes );
rVOpt.SetShowInlineTooltips( m_bShowInlineTooltips );
rVOpt.SetShowOutlineContentVisibilityButton(m_bShowOutlineContentVisibilityButton);
rVOpt.SetTreatSubOutlineLevelsAsContent(m_bTreatSubOutlineLevelsAsContent);
rVOpt.SetShowChangesInMargin( m_bShowChangesInMargin );
rVOpt.SetShowHiddenField(m_bFieldHiddenText );
rVOpt.SetShowHiddenPara(m_bShowHiddenPara );
if (!m_bDefaultZoom)
{
rVOpt.SetZoomType(m_eDefaultZoomType);
if (m_eDefaultZoomType == SvxZoomType::PERCENT)
rVOpt.SetZoom(m_nDefaultZoomValue);
}
}
// CTOR for empty Item
SwAddPrinterItem::SwAddPrinterItem():
SfxPoolItem(FN_PARAM_ADDPRINTER, SfxItemType::SwAddPrinterItemType)
{
}
// CTOR from SwPrintOptions
SwAddPrinterItem::SwAddPrinterItem( const SwPrintData& rPrtData ) :
SfxPoolItem(FN_PARAM_ADDPRINTER, SfxItemType::SwAddPrinterItemType)
{
SwPrintData::operator=(rPrtData);
}
SwAddPrinterItem* SwAddPrinterItem::Clone( SfxItemPool* ) const
{
return new SwAddPrinterItem( *this );
}
bool SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
const SwAddPrinterItem& rItem = static_cast<const SwAddPrinterItem&>(rAttr);
return SwPrintData::operator==(rItem);
}
// Item for Settings dialog, ShadowCursorPage
SwShadowCursorItem::SwShadowCursorItem()
: SfxPoolItem( FN_PARAM_SHADOWCURSOR, SfxItemType::SwShadowCursorItemType ),
m_eMode( SwFillMode::Tab )
,m_bOn( false )
{
}
SwShadowCursorItem::SwShadowCursorItem( const SwViewOption& rVOpt )
: SfxPoolItem( FN_PARAM_SHADOWCURSOR, SfxItemType::SwShadowCursorItemType ),
m_eMode( rVOpt.GetShdwCursorFillMode() )
,m_bOn( rVOpt.IsShadowCursor() )
{
}
SwShadowCursorItem* SwShadowCursorItem::Clone( SfxItemPool* ) const
{
return new SwShadowCursorItem( *this );
}
bool SwShadowCursorItem::operator==( const SfxPoolItem& rCmp ) const
{
return SfxPoolItem::operator==(rCmp) &&
IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
}
void SwShadowCursorItem::FillViewOptions( SwViewOption& rVOpt ) const
{
rVOpt.SetShadowCursor( m_bOn );
rVOpt.SetShdwCursorFillMode( m_eMode );
}
SwFmtAidsAutoComplItem::SwFmtAidsAutoComplItem()
: SfxPoolItem(FN_PARAM_FMT_AIDS_AUTOCOMPL, SfxItemType::SwFmtAidsAutoComplItemType)
, m_bEncloseWithCharactersOn(true)
{
}
SwFmtAidsAutoComplItem::SwFmtAidsAutoComplItem(const SwViewOption& rVOpt)
: SfxPoolItem(FN_PARAM_FMT_AIDS_AUTOCOMPL, SfxItemType::SwFmtAidsAutoComplItemType)
, m_bEncloseWithCharactersOn(rVOpt.IsEncloseWithCharactersOn())
{
}
SwFmtAidsAutoComplItem* SwFmtAidsAutoComplItem::Clone(SfxItemPool*) const
{
return new SwFmtAidsAutoComplItem(*this);
}
bool SwFmtAidsAutoComplItem::operator==(const SfxPoolItem& rCmp) const
{
assert(SfxPoolItem::operator==(rCmp));
const SwFmtAidsAutoComplItem& rItem = static_cast<const SwFmtAidsAutoComplItem&>(rCmp);
return m_bEncloseWithCharactersOn == rItem.m_bEncloseWithCharactersOn;
}
#ifdef DBG_UTIL
SwTestItem* SwTestItem::Clone( SfxItemPool* ) const
{
return new SwTestItem( *this );
}
bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
return ( m_bTest1==rItem.m_bTest1&&
m_bTest2==rItem.m_bTest2&&
m_bTest3==rItem.m_bTest3&&
m_bTest4==rItem.m_bTest4&&
m_bTest5==rItem.m_bTest5&&
m_bTest6==rItem.m_bTest6&&
m_bTest7==rItem.m_bTest7&&
m_bTest8==rItem.m_bTest8&&
m_bTest9==rItem.m_bTest9&&
m_bTest10==rItem.m_bTest10);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */