/* -*- 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 .
*/
/** * AccEditableText.cpp : Implementation of CUAccCOMApp and DLL registration.
*/ #include"stdafx.h" #include <UAccCOM.h> #include"AccEditableText.h"
/** * Copy a range of text to the clipboard. * * @param startOffset the start offset of copying. * @param endOffset the end offset of copying. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::copyText(long startOffset, long endOffset)
{
SolarMutexGuard g;
try
{ if (!m_xEditableText.is())
{ return E_FAIL;
}
if (m_xEditableText->copyText(startOffset, endOffset)) return S_OK;
return E_FAIL;
} catch (...)
{ return E_FAIL;
}
}
/** * Deletes a range of text. * * @param startOffset the start offset of deleting. * @param endOffset the end offset of deleting. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::deleteText(long startOffset, long endOffset)
{
SolarMutexGuard g;
try
{ if (!m_xEditableText.is()) return E_FAIL;
if (m_xEditableText->deleteText(startOffset, endOffset)) return S_OK;
return E_FAIL;
} catch (...)
{ return E_FAIL;
}
}
/** * Inserts text at a specified offset. * * @param offset the offset of inserting. * @param text the text to be inserted. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::insertText(long offset, BSTR* text)
{
SolarMutexGuard g;
try
{ if (text == nullptr) return E_INVALIDARG;
if (!m_xEditableText.is()) return E_FAIL;
OUString ouStr(o3tl::toU(*text));
if (m_xEditableText->insertText(ouStr, offset)) return S_OK;
return E_FAIL;
} catch (...)
{ return E_FAIL;
}
}
/** * Cuts a range of text to the clipboard. * * @param startOffset the start offset of cutting. * @param endOffset the end offset of cutting. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::cutText(long startOffset, long endOffset)
{
SolarMutexGuard g;
try
{ if (!m_xEditableText.is()) return E_FAIL;
if (m_xEditableText->cutText(startOffset, endOffset)) return S_OK;
return E_FAIL;
} catch (...)
{ return E_FAIL;
}
}
/** * Pastes text from clipboard at specified offset. * * @param offset the offset of pasting. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::pasteText(long offset)
{
SolarMutexGuard g;
try
{ if (!m_xEditableText.is()) return E_FAIL;
if (m_xEditableText->pasteText(offset)) return S_OK;
return E_FAIL;
} catch (...)
{ return E_FAIL;
}
}
/** * Replaces range of text with new text. * * @param startOffset the start offset of replacing. * @param endOffset the end offset of replacing. * @param text the replacing text. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset,
BSTR* text)
{
SolarMutexGuard g;
try
{ if (text == nullptr) return E_INVALIDARG; if (!m_xEditableText.is()) return E_FAIL;
/** * Sets attributes of range of text. * * @param startOffset the start offset. * @param endOffset the end offset. * @param attributes the attribute text. * @param success the boolean result to be returned.
*/
COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset,
BSTR* attributes)
{
SolarMutexGuard g;
try
{ if (attributes == nullptr) return E_INVALIDARG; if (!m_xEditableText.is()) return E_FAIL;
// Complete TabStop element.
vecTabStop.push_back(tabStop);
} else break; // No match comma.
} else break; // No match FillChar.
} else break; // No match comma.
} else break; // No match DecimalChar.
} else break; // No match comma.
} else break; // No match TabAlign.
} else break; // No match comma.
} else break; // No match Position.
} while (pos < ouValue.getLength());
// Dump into Sequence. int iSeqLen = vecTabStop.empty() ? 1 : vecTabStop.size();
Sequence<css::style::TabStop> seqTabStop(iSeqLen); auto pseqTabStop = seqTabStop.getArray();
if (!vecTabStop.empty())
{ // Dump every element. for (int i = 0; i < iSeqLen; i++)
{
pseqTabStop[i] = vecTabStop[i];
}
} else
{ // Create default value.
pseqTabStop[0].Position = 0;
pseqTabStop[0].Alignment = css::style::TabAlign_DEFAULT;
pseqTabStop[0].DecimalChar = '.';
pseqTabStop[0].FillChar = ' ';
}
// Assign to Any object.
rAny.setValue(&seqTabStop, cppu::UnoType<Sequence<css::style::TabStop>>::get());
} elseif (ouName == u"ParaLineSpacing")
{ // Parse value string.
css::style::LineSpacing lineSpacing;
OUString ouSubValue;
sal_Int32 pos = 0, posComma = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.