<commit_before>/*
 * 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 <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <AlignmentPropertyPanel.hxx>
#include <AlignmentPropertyPanel.hrc>
#include <editeng/justifyitem.hxx>
#include <svx/dialmgr.hxx>
#include "sc.hrc"
#include "scresid.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <svx/algitem.hxx>
#include <svx/dlgutil.hxx>
#include <vcl/toolbox.hxx>
#include <svx/sidebar/SidebarDialControl.hxx>

using namespace css;
using namespace cssu;
using ::sfx2::sidebar::ControlFactory;

const char UNO_ALIGNBLOCK[]            = ".uno:AlignBlock";
const char UNO_ALIGNBOTTOM[]           = ".uno:AlignBottom";
const char UNO_ALIGNLEFT[]             = ".uno:AlignLeft";
const char UNO_ALIGNHORIZONTALCENTER[] = ".uno:AlignHorizontalCenter";
const char UNO_ALIGNRIGHT[]            = ".uno:AlignRight";
const char UNO_ALIGNTOP[]              = ".uno:AlignTop";
const char UNO_ALIGNVCENTER[]          = ".uno:AlignVCenter";

#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))

//////////////////////////////////////////////////////////////////////////////
// namespace open

namespace sc { namespace sidebar {

//////////////////////////////////////////////////////////////////////////////

AlignmentPropertyPanel::AlignmentPropertyPanel(
    Window* pParent,
    const cssu::Reference<css::frame::XFrame>& rxFrame,
    SfxBindings* pBindings)
    : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui", rxFrame),
      maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this),
      maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this),
      maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this),
      maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this),
      maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
      maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
      maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
      meHorAlignState(SVX_HOR_JUSTIFY_STANDARD),
      meVerAlignState(SVX_VER_JUSTIFY_STANDARD),
      mbMultiDisable(false),
      mxFrame(rxFrame),
      maContext(),
      mpBindings(pBindings)
{
    get(mpTBHorizontal, "horizontalalignment");
    get(mpTBVertical, "verticalalignment");
    get(mpFTLeftIndent, "leftindentlabel");
    get(mpMFLeftIndent, "leftindent");
    get(mpCBXWrapText, "wraptext");
    get(mpCBXMergeCell, "mergecells");
    get(mpFtRotate, "orientationlabel");
    get(mpCtrlDial, "orientationcontrol");
    get(mpMtrAngle, "orientationdegrees");
    get(mpCbStacked, "verticallystacked");

    Initialize();

    mpFTLeftIndent->SetBackground(Wallpaper());
    mpFtRotate->SetBackground(Wallpaper());
}

//////////////////////////////////////////////////////////////////////////////

AlignmentPropertyPanel::~AlignmentPropertyPanel()
{
}

//////////////////////////////////////////////////////////////////////////////

void AlignmentPropertyPanel::Initialize()
{
    Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() );
    mpTBHorizontal->SetOutputSizePixel( aTbxSize );
    mpTBHorizontal->SetBackground(Wallpaper());
    mpTBHorizontal->SetPaintTransparent(true);
    Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
    mpTBHorizontal->SetSelectHdl ( aLink );

    Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() );
    mpTBVertical->SetOutputSizePixel( aTbxSize2 );
    mpTBVertical->SetBackground(Wallpaper());
    mpTBVertical->SetPaintTransparent(true);
    aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl);
    mpTBVertical->SetSelectHdl ( aLink );

    mpFTLeftIndent->Disable();
    mpMFLeftIndent->Disable();
    mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent")));    //wj acc
    aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl);
    mpMFLeftIndent->SetModifyHdl ( aLink );
<commit_msg>sidebar conversion tutorial: Cleanup - remove calls of SetOutputSizePixel().<commit_after>/*
 * 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 <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <AlignmentPropertyPanel.hxx>
#include <AlignmentPropertyPanel.hrc>
#include <editeng/justifyitem.hxx>
#include <svx/dialmgr.hxx>
#include "sc.hrc"
#include "scresid.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <svx/algitem.hxx>
#include <svx/dlgutil.hxx>
#include <vcl/toolbox.hxx>
#include <svx/sidebar/SidebarDialControl.hxx>

using namespace css;
using namespace cssu;
using ::sfx2::sidebar::ControlFactory;

const char UNO_ALIGNBLOCK[]            = ".uno:AlignBlock";
const char UNO_ALIGNBOTTOM[]           = ".uno:AlignBottom";
const char UNO_ALIGNLEFT[]             = ".uno:AlignLeft";
const char UNO_ALIGNHORIZONTALCENTER[] = ".uno:AlignHorizontalCenter";
const char UNO_ALIGNRIGHT[]            = ".uno:AlignRight";
const char UNO_ALIGNTOP[]              = ".uno:AlignTop";
const char UNO_ALIGNVCENTER[]          = ".uno:AlignVCenter";

#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))

//////////////////////////////////////////////////////////////////////////////
// namespace open

namespace sc { namespace sidebar {

//////////////////////////////////////////////////////////////////////////////

AlignmentPropertyPanel::AlignmentPropertyPanel(
    Window* pParent,
    const cssu::Reference<css::frame::XFrame>& rxFrame,
    SfxBindings* pBindings)
    : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui", rxFrame),
      maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this),
      maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this),
      maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this),
      maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this),
      maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
      maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
      maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
      meHorAlignState(SVX_HOR_JUSTIFY_STANDARD),
      meVerAlignState(SVX_VER_JUSTIFY_STANDARD),
      mbMultiDisable(false),
      mxFrame(rxFrame),
      maContext(),
      mpBindings(pBindings)
{
    get(mpTBHorizontal, "horizontalalignment");
    get(mpTBVertical, "verticalalignment");
    get(mpFTLeftIndent, "leftindentlabel");
    get(mpMFLeftIndent, "leftindent");
    get(mpCBXWrapText, "wraptext");
    get(mpCBXMergeCell, "mergecells");
    get(mpFtRotate, "orientationlabel");
    get(mpCtrlDial, "orientationcontrol");
    get(mpMtrAngle, "orientationdegrees");
    get(mpCbStacked, "verticallystacked");

    Initialize();

    mpFTLeftIndent->SetBackground(Wallpaper());
    mpFtRotate->SetBackground(Wallpaper());
}

//////////////////////////////////////////////////////////////////////////////

AlignmentPropertyPanel::~AlignmentPropertyPanel()
{
}

//////////////////////////////////////////////////////////////////////////////

void AlignmentPropertyPanel::Initialize()
{
    Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
    mpTBHorizontal->SetSelectHdl ( aLink );

    aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl);
    mpTBVertical->SetSelectHdl ( aLink );

    mpFTLeftIndent->Disable();
    mpMFLeftIndent->Disable();
    mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent")));    //wj acc
    aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl);
    mpMFLeftIndent->SetModifyHdl ( aLink );

{'fraction_non_alphanumeric': 0.1748342931652722, 'fraction_numerical': 0.003477127023796588, 'mean_word_length': 3.368296155671571, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1782104', 'n_tokens_mistral': 2875, 'n_tokens_neox': 2816, 'n_words': 589}